PublishedContent - align with v7, refactor IPublishedProperty & names
This commit is contained in:
@@ -31,19 +31,20 @@ namespace Umbraco.Core.Dynamics
|
||||
|
||||
internal PropertyResultType PropertyType { get { return _type; } }
|
||||
|
||||
public string Alias { get { return _source == null ? _alias : _source.Alias; } }
|
||||
public object RawValue { get { return _source == null ? _value : _source.RawValue; } }
|
||||
public string PropertyTypeAlias { get { return _source == null ? _alias : _source.PropertyTypeAlias; } }
|
||||
public object DataValue { get { return _source == null ? _value : _source.DataValue; } }
|
||||
public bool HasValue { get { return _source == null || _source.HasValue; } }
|
||||
public object Value { get { return _source == null ? _value : _source.Value; } }
|
||||
public object XPathValue { get { return Value == null ? null : Value.ToString(); } }
|
||||
public object ObjectValue { get { return _source == null ? _value : _source.ObjectValue; } }
|
||||
// fixme - is it OK to return null here?
|
||||
public object XPathValue { get { return ObjectValue == null ? null : ObjectValue.ToString(); } }
|
||||
|
||||
// implements IHtmlString.ToHtmlString
|
||||
public string ToHtmlString()
|
||||
{
|
||||
// note - use RawValue here, because that's what the original
|
||||
// note - use DataValue here, because that's what the original
|
||||
// Razor macro engine seems to do...
|
||||
|
||||
var value = RawValue;
|
||||
var value = DataValue;
|
||||
return value == null ? string.Empty : value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Umbraco.Tests.CodeFirst
|
||||
|
||||
foreach (var property in content.Properties)
|
||||
{
|
||||
var @alias = property.Alias;
|
||||
var @alias = property.PropertyTypeAlias;
|
||||
|
||||
var propertyInfo = propertyInfos.FirstOrDefault(x => x.Name.ToUmbracoAlias() == @alias);
|
||||
if (propertyInfo == null) continue;
|
||||
@@ -27,12 +27,12 @@ namespace Umbraco.Tests.CodeFirst
|
||||
object value = null;
|
||||
//TODO Proper mapping of types
|
||||
if (propertyInfo.PropertyType == typeof(string))
|
||||
value = property.Value;
|
||||
value = property.ObjectValue;
|
||||
else if (propertyInfo.PropertyType == typeof(DateTime))
|
||||
value = DateTime.Parse(property.Value.ToString());
|
||||
value = DateTime.Parse(property.ObjectValue.ToString());
|
||||
else if (propertyInfo.PropertyType == typeof(Boolean))
|
||||
{
|
||||
if (String.IsNullOrEmpty(property.Value.ToString()) || property.Value == "0")
|
||||
if (String.IsNullOrEmpty(property.ObjectValue.ToString()) || property.ObjectValue == "0")
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
|
||||
@@ -243,11 +243,11 @@ namespace Umbraco.Tests.PublishedCache
|
||||
a => null,
|
||||
//we're not going to test this so ignore
|
||||
a => new List<IPublishedContent>(),
|
||||
(dd, a) => dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(a)),
|
||||
(dd, a) => dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(a)),
|
||||
false),
|
||||
//callback to get the children
|
||||
d => children,
|
||||
(dd, a) => dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(a)),
|
||||
(dd, a) => dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(a)),
|
||||
false);
|
||||
return dicDoc;
|
||||
}
|
||||
|
||||
@@ -214,14 +214,14 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
public object this[string propertyAlias]
|
||||
{
|
||||
get { return GetProperty(propertyAlias).RawValue; } // fixme - why not just .Value?
|
||||
get { return GetProperty(propertyAlias).DataValue; } // fixme - why DataValue here?
|
||||
}
|
||||
|
||||
public IEnumerable<IPublishedContent> Children { get; set; }
|
||||
|
||||
public IPublishedProperty GetProperty(string alias)
|
||||
{
|
||||
return Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
|
||||
return Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
|
||||
public IPublishedProperty GetProperty(string alias, bool recurse)
|
||||
|
||||
@@ -226,10 +226,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
new SolidPublishedProperty
|
||||
{
|
||||
Alias = "prop1",
|
||||
PropertyTypeAlias = "prop1",
|
||||
HasValue = true,
|
||||
Value = 1234,
|
||||
RawValue = "1234"
|
||||
ObjectValue = 1234,
|
||||
DataValue = "1234"
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -249,10 +249,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
new SolidPublishedProperty
|
||||
{
|
||||
Alias = "prop1",
|
||||
PropertyTypeAlias = "prop1",
|
||||
HasValue = true,
|
||||
Value = 1234,
|
||||
RawValue = "1234"
|
||||
ObjectValue = 1234,
|
||||
DataValue = "1234"
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -272,10 +272,10 @@ namespace Umbraco.Tests.PublishedContent
|
||||
{
|
||||
new SolidPublishedProperty
|
||||
{
|
||||
Alias = "prop1",
|
||||
PropertyTypeAlias = "prop1",
|
||||
HasValue = true,
|
||||
Value = 1234,
|
||||
RawValue = "1234"
|
||||
ObjectValue = 1234,
|
||||
DataValue = "1234"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
|
||||
public IPublishedProperty GetProperty(string alias)
|
||||
{
|
||||
return Properties.FirstOrDefault(p => p.Alias.InvariantEquals(alias));
|
||||
return Properties.FirstOrDefault(p => p.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
|
||||
public IPublishedProperty GetProperty(string alias, bool recurse)
|
||||
@@ -206,7 +206,7 @@ namespace Umbraco.Tests.PublishedContent
|
||||
get
|
||||
{
|
||||
var property = GetProperty(alias);
|
||||
return property == null || property.HasValue == false ? null : property.Value;
|
||||
return property == null || property.HasValue == false ? null : property.ObjectValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,9 +220,9 @@ namespace Umbraco.Tests.PublishedContent
|
||||
// initialize boring stuff
|
||||
}
|
||||
|
||||
public string Alias { get; set; }
|
||||
public object RawValue { get; set; }
|
||||
public object Value { get; set; }
|
||||
public string PropertyTypeAlias { get; set; }
|
||||
public object DataValue { get; set; }
|
||||
public object ObjectValue { get; set; }
|
||||
public bool HasValue { get; set; }
|
||||
public object XPathValue { get; set; }
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace Umbraco.Web.Models
|
||||
{
|
||||
var reflectedProperty = GetReflectedProperty(binder.Name);
|
||||
var result = reflectedProperty != null
|
||||
? reflectedProperty.Value
|
||||
? reflectedProperty.ObjectValue
|
||||
: null;
|
||||
|
||||
return Attempt.If(result != null, result);
|
||||
@@ -722,8 +722,8 @@ namespace Umbraco.Web.Models
|
||||
public string GetPropertyValue(string alias, bool recursive)
|
||||
{
|
||||
var property = GetProperty(alias, recursive);
|
||||
if (property == null || property.Value == null) return null;
|
||||
return property.Value.ToString();
|
||||
if (property == null || property.ObjectValue == null) return null;
|
||||
return property.ObjectValue.ToString();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Umbraco.Web.Models
|
||||
var prop = GetProperty(Constants.Conventions.Media.File);
|
||||
if (prop == null)
|
||||
throw new NotSupportedException("Cannot resolve a Url for a media item when there is no 'umbracoFile' property defined.");
|
||||
_url = prop.Value.ToString();
|
||||
_url = prop.ObjectValue.ToString();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
@@ -144,7 +144,7 @@ namespace Umbraco.Web.Models
|
||||
{
|
||||
// no cache here: GetProperty should be fast, and .Value cache should be managed by the property.
|
||||
var property = GetProperty(alias);
|
||||
return property == null ? null : property.Value;
|
||||
return property == null ? null : property.ObjectValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -322,14 +322,15 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
if (dd.LoadedFromExamine)
|
||||
{
|
||||
//if this is from Examine, lets check if the alias does not exist on the document
|
||||
if (dd.Properties.All(x => x.Alias != alias))
|
||||
if (dd.Properties.All(x => x.PropertyTypeAlias != alias))
|
||||
{
|
||||
//ok it doesn't exist, we might assume now that Examine didn't index this property because the index is not set up correctly
|
||||
//so before we go loading this from the database, we can check if the alias exists on the content type at all, this information
|
||||
//is cached so will be quicker to look up.
|
||||
if (dd.Properties.Any(x => x.Alias == UmbracoContentIndexer.NodeTypeAliasFieldName))
|
||||
if (dd.Properties.Any(x => x.PropertyTypeAlias == UmbracoContentIndexer.NodeTypeAliasFieldName))
|
||||
{
|
||||
var aliasesAndNames = ContentType.GetAliasesAndNames(dd.Properties.First(x => x.Alias.InvariantEquals(UmbracoContentIndexer.NodeTypeAliasFieldName)).RawValue.ToString());
|
||||
// fixme - is it OK to use DataValue here?
|
||||
var aliasesAndNames = ContentType.GetAliasesAndNames(dd.Properties.First(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.NodeTypeAliasFieldName)).DataValue.ToString());
|
||||
if (aliasesAndNames != null)
|
||||
{
|
||||
if (!aliasesAndNames.ContainsKey(alias))
|
||||
@@ -346,7 +347,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
{
|
||||
media.MoveNext();
|
||||
var mediaDoc = ConvertFromXPathNavigator(media.Current);
|
||||
return mediaDoc.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
|
||||
return mediaDoc.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,9 +355,9 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
//We've made it here which means that the value is stored in the Examine index.
|
||||
//We are going to check for a special field however, that is because in some cases we store a 'Raw'
|
||||
//value in the index such as for xml/html.
|
||||
var rawValue = dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(UmbracoContentIndexer.RawFieldPrefix + alias));
|
||||
var rawValue = dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(UmbracoContentIndexer.RawFieldPrefix + alias));
|
||||
return rawValue
|
||||
?? dd.Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
|
||||
?? dd.Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
|
||||
public override IPublishedProperty GetProperty(string alias)
|
||||
{
|
||||
return Properties.FirstOrDefault(x => x.Alias.InvariantEquals(alias));
|
||||
return Properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
|
||||
}
|
||||
|
||||
// override to implement cache
|
||||
|
||||
@@ -18,14 +18,14 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
{
|
||||
private readonly string _xmlValue; // the raw, xml node value
|
||||
private readonly Lazy<object> _sourceValue;
|
||||
private readonly Lazy<object> _value;
|
||||
private readonly Lazy<object> _objectValue;
|
||||
private readonly Lazy<object> _xpathValue;
|
||||
private readonly bool _isPreviewing;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the raw value of the property.
|
||||
/// </summary>
|
||||
public override object RawValue { get { return _xmlValue; } }
|
||||
public override object DataValue { get { return _xmlValue; } }
|
||||
|
||||
// in the Xml cache, everything is a string, and to have a value
|
||||
// you want to have a non-null, non-empty string.
|
||||
@@ -34,7 +34,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
get { return _xmlValue.Trim().Length > 0; }
|
||||
}
|
||||
|
||||
public override object Value { get { return _value.Value; } }
|
||||
public override object ObjectValue { get { return _objectValue.Value; } }
|
||||
public override object XPathValue { get { return _xpathValue.Value; } }
|
||||
|
||||
public XmlPublishedProperty(PublishedPropertyType propertyType, bool isPreviewing, XmlNode propertyXmlData)
|
||||
@@ -60,7 +60,7 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
|
||||
_isPreviewing = isPreviewing;
|
||||
|
||||
_sourceValue = new Lazy<object>(() => PropertyType.ConvertDataToSource(_xmlValue, _isPreviewing));
|
||||
_value = new Lazy<object>(() => PropertyType.ConvertSourceToObject(_sourceValue.Value, _isPreviewing));
|
||||
_objectValue = new Lazy<object>(() => PropertyType.ConvertSourceToObject(_sourceValue.Value, _isPreviewing));
|
||||
_xpathValue = new Lazy<object>(() => PropertyType.ConvertSourceToXPath(_sourceValue.Value, _isPreviewing));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Umbraco.Web
|
||||
public static object GetPropertyValue(this IPublishedContent content, string alias)
|
||||
{
|
||||
var property = content.GetProperty(alias);
|
||||
return property == null ? null : property.Value;
|
||||
return property == null ? null : property.ObjectValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -225,7 +225,7 @@ namespace Umbraco.Web
|
||||
public static object GetPropertyValue(this IPublishedContent content, string alias, string defaultValue)
|
||||
{
|
||||
var property = content.GetProperty(alias);
|
||||
return property == null || property.HasValue == false ? defaultValue : property.Value;
|
||||
return property == null || property.HasValue == false ? defaultValue : property.ObjectValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -244,7 +244,7 @@ namespace Umbraco.Web
|
||||
public static object GetPropertyValue(this IPublishedContent content, string alias, object defaultValue)
|
||||
{
|
||||
var property = content.GetProperty(alias);
|
||||
return property == null || property.HasValue == false ? defaultValue : property.Value;
|
||||
return property == null || property.HasValue == false ? defaultValue : property.ObjectValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -264,7 +264,7 @@ namespace Umbraco.Web
|
||||
public static object GetPropertyValue(this IPublishedContent content, string alias, bool recurse)
|
||||
{
|
||||
var property = content.GetProperty(alias, recurse);
|
||||
return property == null ? null : property.Value;
|
||||
return property == null ? null : property.ObjectValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -285,7 +285,7 @@ namespace Umbraco.Web
|
||||
public static object GetPropertyValue(this IPublishedContent content, string alias, bool recurse, object defaultValue)
|
||||
{
|
||||
var property = content.GetProperty(alias, recurse);
|
||||
return property == null || property.HasValue == false ? defaultValue : property.Value;
|
||||
return property == null || property.HasValue == false ? defaultValue : property.ObjectValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1619,9 +1619,10 @@ namespace Umbraco.Web
|
||||
};
|
||||
|
||||
var userVals = new Dictionary<string, object>();
|
||||
foreach (var p in from IPublishedProperty p in n.Properties where p.RawValue != null select p)
|
||||
// fixme - is it OK to use DataValue here?
|
||||
foreach (var p in from IPublishedProperty p in n.Properties where p.DataValue != null select p)
|
||||
{
|
||||
userVals[p.Alias] = p.RawValue; // use the raw, unprocessed value
|
||||
userVals[p.PropertyTypeAlias] = p.DataValue; // use the raw, unprocessed value
|
||||
}
|
||||
//add the row data
|
||||
Core.DataTableExtensions.AddRowData(tableData, standardVals, userVals);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Umbraco.Web
|
||||
// else we use .Value so we give the converter a chance to handle the default value differently
|
||||
// eg for IEnumerable<T> it may return Enumerable<T>.Empty instead of null
|
||||
|
||||
var value = property.Value;
|
||||
var value = property.ObjectValue;
|
||||
|
||||
// if value is null (strange but why not) it still is OK to call TryConvertTo
|
||||
// because it's an extension method (hence no NullRef) which will return a
|
||||
|
||||
@@ -363,9 +363,9 @@ namespace umbraco
|
||||
}
|
||||
|
||||
// the legacy library returns the string value from the xml cache - which means a string
|
||||
// that has not be converted at all -- use RawValue here.
|
||||
// that has not be converted at all -- use DataValue here.
|
||||
var prop = doc.GetProperty(alias);
|
||||
return prop == null ? string.Empty : prop.RawValue.ToString();
|
||||
return prop == null ? string.Empty : prop.DataValue.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -273,9 +273,9 @@ namespace umbraco
|
||||
{
|
||||
foreach(var p in node.Properties)
|
||||
{
|
||||
if (!_elements.ContainsKey(p.Alias))
|
||||
if (!_elements.ContainsKey(p.PropertyTypeAlias))
|
||||
{
|
||||
_elements[p.Alias] = p.Value;
|
||||
_elements[p.PropertyTypeAlias] = p.ObjectValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace umbraco.MacroEngines.Library
|
||||
{
|
||||
internal static IProperty ConvertToNodeProperty(this IPublishedProperty prop)
|
||||
{
|
||||
return new PropertyResult(prop.Alias, prop.Value.ToString());
|
||||
return new PropertyResult(prop.PropertyTypeAlias, prop.ObjectValue.ToString());
|
||||
}
|
||||
|
||||
internal static INode ConvertToNode(this IPublishedContent doc)
|
||||
|
||||
Reference in New Issue
Block a user