Published variants - WIP
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
/// <para>Other caches that get their raw value from the database would consider that a property has "no
|
||||
/// value" if it is missing, null, or an empty string (including whitespace-only).</para>
|
||||
/// </remarks>
|
||||
bool HasValue { get; }
|
||||
bool HasValue(int? languageId = null, string segment = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the source value of the property.
|
||||
@@ -35,7 +35,7 @@
|
||||
/// <para>If you're using that value, you're probably wrong, unless you're doing some internal
|
||||
/// Umbraco stuff.</para>
|
||||
/// </remarks>
|
||||
object SourceValue { get; }
|
||||
object GetSourceValue(int? languageId = null, string segment = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object value of the property.
|
||||
@@ -45,7 +45,7 @@
|
||||
/// <para>It can be null, or any type of CLR object.</para>
|
||||
/// <para>It has been fully prepared and processed by the appropriate converter.</para>
|
||||
/// </remarks>
|
||||
object Value { get; }
|
||||
object GetValue(int? languageId = null, string segment = null);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the XPath value of the property.
|
||||
@@ -55,6 +55,6 @@
|
||||
/// <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; }
|
||||
object GetXPathValue(int? languageId = null, string segment = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,9 +40,9 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
public PropertyCacheLevel ReferenceCacheLevel { get; }
|
||||
|
||||
// these have to be provided by the actual implementation
|
||||
public abstract bool HasValue { get; }
|
||||
public abstract object SourceValue { get; }
|
||||
public abstract object Value { get; }
|
||||
public abstract object XPathValue { get; }
|
||||
public abstract bool HasValue(int? languageId = null, string segment = null);
|
||||
public abstract object GetSourceValue(int? languageId = null, string segment = null);
|
||||
public abstract object GetValue(int? languageId = null, string segment = null);
|
||||
public abstract object GetXPathValue(int? languageId = null, string segment = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace Umbraco.Core.Models.PublishedContent
|
||||
private readonly Lazy<object> _objectValue;
|
||||
private readonly Lazy<object> _xpathValue;
|
||||
|
||||
public override object SourceValue => _propertyData;
|
||||
public override object GetSourceValue(int? languageId = null, string segment = null) => _propertyData;
|
||||
|
||||
public override bool HasValue => _propertyData is string s ? !string.IsNullOrWhiteSpace(s) : _propertyData != null;
|
||||
public override bool HasValue(int? languageId = null, string segment = null) => _propertyData is string s ? !string.IsNullOrWhiteSpace(s) : _propertyData != null;
|
||||
|
||||
public override object Value => _objectValue.Value;
|
||||
public override object GetValue(int? languageId = null, string segment = null) => _objectValue.Value;
|
||||
|
||||
public override object XPathValue => _xpathValue.Value;
|
||||
public override object GetXPathValue(int? languageId = null, string segment = null) => _xpathValue.Value;
|
||||
|
||||
public RawValueProperty(PublishedPropertyType propertyType, IPublishedElement content, object propertyData, bool isPreviewing = false)
|
||||
: base(propertyType, PropertyCacheLevel.Unknown) // cache level is ignored
|
||||
|
||||
Reference in New Issue
Block a user