PublishedContent - align with v7, refactor IPublishedProperty & names
This commit is contained in:
@@ -10,7 +10,7 @@ namespace Umbraco.Core.Models
|
||||
/// <summary>
|
||||
/// Gets the alias of the property.
|
||||
/// </summary>
|
||||
string Alias { get; }
|
||||
string PropertyTypeAlias { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the property has a value.
|
||||
@@ -26,34 +26,34 @@ namespace Umbraco.Core.Models
|
||||
bool HasValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the raw value of the property.
|
||||
/// Gets the data value of the property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>The raw value is whatever was passed to the property when it was instanciated, and it is
|
||||
/// <para>The data value is whatever was passed to the property when it was instanciated, and it is
|
||||
/// somewhat implementation-dependent -- depending on how the IPublishedCache is implemented.</para>
|
||||
/// <para>The XmlPublishedCache raw values are strings exclusively since they come from the Xml cache.</para>
|
||||
/// <para>For other cachesthat get their raw value from the database, it would be either a string,
|
||||
/// <para>For other caches that get their raw value from the database, it would be either a string,
|
||||
/// an integer (Int32), or a date and time (DateTime).</para>
|
||||
/// </remarks>
|
||||
object RawValue { get; }
|
||||
object DataValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the property.
|
||||
/// Gets the object value of the property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>The value is what you want to use when rendering content in an MVC view ie in C#.</para>
|
||||
/// <para>It can be null, or any type of CLR object.</para>
|
||||
/// <para>It has been fully prepared and processed by the appropriate converters.</para>
|
||||
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
|
||||
/// </remarks>
|
||||
object Value { get; }
|
||||
object ObjectValue { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the XPath value of the property.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>The XPath value is what you want to use when navigating content via XPath eg in the XSLT engine.</para>
|
||||
/// <para>It must be either null, or a non-empty string, or an XPathNavigator.</para>
|
||||
/// <para>It has been fully prepared and processed by the appropriate converters.</para>
|
||||
/// <para>It must be either null, or a string, or an XPathNavigator.</para>
|
||||
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
|
||||
/// </remarks>
|
||||
object XPathValue { get; }
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
{
|
||||
if (_properties != null)
|
||||
{
|
||||
var property = _properties.FirstOrDefault(prop => prop.Alias.InvariantEquals(alias));
|
||||
if (property != null) return property.HasValue ? property.Value : null;
|
||||
var property = _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias));
|
||||
if (property != null) return property.HasValue ? property.ObjectValue : null;
|
||||
}
|
||||
return Content[alias];
|
||||
}
|
||||
@@ -142,7 +142,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
{
|
||||
return _properties == null
|
||||
? Content.GetProperty(alias)
|
||||
: _properties.FirstOrDefault(prop => prop.Alias.InvariantEquals(alias)) ?? Content.GetProperty(alias);
|
||||
: _properties.FirstOrDefault(prop => prop.PropertyTypeAlias.InvariantEquals(alias)) ?? Content.GetProperty(alias);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -17,15 +17,15 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
PropertyType = propertyType;
|
||||
}
|
||||
|
||||
public string Alias
|
||||
public string PropertyTypeAlias
|
||||
{
|
||||
get { return PropertyType.PropertyTypeAlias; }
|
||||
}
|
||||
|
||||
// these have to be provided by the actual implementation
|
||||
public abstract bool HasValue { get; }
|
||||
public abstract object RawValue { get; }
|
||||
public abstract object Value { get; }
|
||||
public abstract object DataValue { get; }
|
||||
public abstract object ObjectValue { get; }
|
||||
public abstract object XPathValue { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,18 +25,21 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
|
||||
DataTypeId = propertyType.DataTypeDefinitionId;
|
||||
PropertyEditorGuid = propertyType.DataTypeId;
|
||||
//PropertyEditorAlias = propertyType.PropertyEditorAlias;
|
||||
|
||||
InitializeConverters();
|
||||
}
|
||||
|
||||
// for unit tests
|
||||
internal PublishedPropertyType(string propertyTypeAlias, int dataTypeDefinitionId, Guid propertyEditorGuid)
|
||||
//internal PublishedPropertyType(string propertyTypeAlias, int dataTypeDefinitionId, Alias propertyEditorAlias)
|
||||
{
|
||||
// ContentType to be set by PublishedContentType when creating it
|
||||
PropertyTypeAlias = propertyTypeAlias;
|
||||
|
||||
DataTypeId = dataTypeDefinitionId;
|
||||
PropertyEditorGuid = propertyEditorGuid;
|
||||
//PropertyEditorAlias = PropertyEditorAlias;
|
||||
|
||||
InitializeConverters();
|
||||
}
|
||||
@@ -59,9 +62,6 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
/// </summary>
|
||||
public int DataTypeId { get; private set; }
|
||||
|
||||
// note: in v6 a property editor is uniquely identified by a guid, whereas in v7
|
||||
// it is uniquely identified by a string alias // fixme - compat?
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the guid uniquely identifying the property editor for the property type.
|
||||
/// </summary>
|
||||
@@ -70,7 +70,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
/// <summary>
|
||||
/// Gets or sets the alias uniquely identifying the property editor for the property type.
|
||||
/// </summary>
|
||||
public string PropertyEditorAlias { get; private set; }
|
||||
//public string PropertyEditorAlias { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user