diff --git a/src/Umbraco.Core/Dynamics/PropertyResult.cs b/src/Umbraco.Core/Dynamics/PropertyResult.cs
index 59d3a0f247..4b6f83c1d2 100644
--- a/src/Umbraco.Core/Dynamics/PropertyResult.cs
+++ b/src/Umbraco.Core/Dynamics/PropertyResult.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
using Umbraco.Core.Models;
using System.Web;
@@ -43,5 +44,13 @@ namespace Umbraco.Core.Dynamics
var value = Value;
return value == null ? string.Empty : value.ToString();
}
+
+ // see notes in IPublishedProperty
+ [Obsolete("Use PropertyTypeAlias.", true)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Alias { get { return PropertyTypeAlias; } }
+ [Obsolete]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Guid Version { get { return Guid.Empty; } }
}
}
diff --git a/src/Umbraco.Core/Models/IPublishedProperty.cs b/src/Umbraco.Core/Models/IPublishedProperty.cs
index f6afa1f05e..6a93bc85ec 100644
--- a/src/Umbraco.Core/Models/IPublishedProperty.cs
+++ b/src/Umbraco.Core/Models/IPublishedProperty.cs
@@ -1,9 +1,12 @@
+using System;
+using System.ComponentModel;
+
namespace Umbraco.Core.Models
{
///
/// Represents a property of an IPublishedContent.
///
- public interface IPublishedProperty
+ public interface IPublishedProperty : IPublishedContentProperty
{
///
/// Gets the alias of the property.
@@ -45,7 +48,7 @@ namespace Umbraco.Core.Models
/// It can be null, or any type of CLR object.
/// It has been fully prepared and processed by the appropriate converter.
///
- object Value { get; }
+ new object Value { get; }
///
/// Gets the XPath value of the property.
@@ -57,4 +60,14 @@ namespace Umbraco.Core.Models
///
object XPathValue { get; }
}
+
+ // had to re-introduce that one for backward-compatibility reasons
+ [Obsolete("Use IPublishedProperty.", false)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public interface IPublishedContentProperty
+ {
+ string Alias { get; }
+ object Value { get; }
+ Guid Version { get; }
+ }
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs
index b841b85212..06c3dfbfa9 100644
--- a/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs
+++ b/src/Umbraco.Core/Models/PublishedContent/PublishedPropertyBase.cs
@@ -1,4 +1,5 @@
using System;
+using System.ComponentModel;
namespace Umbraco.Core.Models.PublishedContent
{
@@ -27,5 +28,13 @@ namespace Umbraco.Core.Models.PublishedContent
public abstract object DataValue { get; }
public abstract object Value { get; }
public abstract object XPathValue { get; }
+
+ // see notes in IPublishedProperty
+ [Obsolete("Use PropertyTypeAlias.", true)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Alias { get { return PropertyTypeAlias; } }
+ [Obsolete]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Guid Version { get { return Guid.Empty; } }
}
}
diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs
index be357c4c03..04414f9e99 100644
--- a/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs
+++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTestElements.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -231,6 +232,14 @@ namespace Umbraco.Tests.PublishedContent
public object Value { get; set; }
public bool HasValue { get; set; }
public object XPathValue { get; set; }
+
+ // see notes in IPublishedProperty
+ [Obsolete("Use PropertyTypeAlias.", true)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Alias { get { return PropertyTypeAlias; } }
+ [Obsolete]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Guid Version { get { return Guid.Empty; } }
}
[PublishedContentModel("ContentType2")]
diff --git a/src/Umbraco.Web/PublishedContentPropertyExtension.cs b/src/Umbraco.Web/PublishedContentPropertyExtension.cs
index ee4dd83e57..54a77ddd0c 100644
--- a/src/Umbraco.Web/PublishedContentPropertyExtension.cs
+++ b/src/Umbraco.Web/PublishedContentPropertyExtension.cs
@@ -1,4 +1,5 @@
-using Umbraco.Core;
+using System;
+using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web.PropertyEditors;
@@ -57,5 +58,27 @@ namespace Umbraco.Web
}
#endregion
+
+ #region IPublishedContentProperty.GetValue
+
+ // see notes in IPublishedProperty
+
+ public static T GetValue(this IPublishedContentProperty property)
+ {
+ var property2 = property as IPublishedProperty;
+ if (property2 == null) // should never happen
+ throw new ArgumentException("Not an IPublishedProperty.", "property");
+ return property2.GetValue(false, default(T));
+ }
+
+ public static T GetValue(this IPublishedContentProperty property, T defaultValue)
+ {
+ var property2 = property as IPublishedProperty;
+ if (property2 == null) // should never happen
+ throw new ArgumentException("Not an IPublishedProperty.", "property");
+ return property2.GetValue(true, defaultValue);
+ }
+
+ #endregion
}
}