From int languageId to string culture

This commit is contained in:
Stephan
2018-04-21 09:57:28 +02:00
parent 5d1abaa713
commit a69019aea0
64 changed files with 708 additions and 626 deletions

View File

@@ -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(int? languageId = null, string segment = null);
bool HasValue(string culture = 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 GetSourceValue(int? languageId = null, string segment = null);
object GetSourceValue(string culture = 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 GetValue(int? languageId = null, string segment = null);
object GetValue(string culture = 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 GetXPathValue(int? languageId = null, string segment = null);
object GetXPathValue(string culture = null, string segment = null);
}
}

View File

@@ -53,15 +53,15 @@ namespace Umbraco.Core.Models.PublishedContent
public string Alias => PropertyType.Alias;
/// <inheritdoc />
public abstract bool HasValue(int? languageId = null, string segment = null);
public abstract bool HasValue(string culture = null, string segment = null);
/// <inheritdoc />
public abstract object GetSourceValue(int? languageId = null, string segment = null);
public abstract object GetSourceValue(string culture = null, string segment = null);
/// <inheritdoc />
public abstract object GetValue(int? languageId = null, string segment = null);
public abstract object GetValue(string culture = null, string segment = null);
/// <inheritdoc />
public abstract object GetXPathValue(int? languageId = null, string segment = null);
public abstract object GetXPathValue(string culture = null, string segment = null);
}
}

View File

@@ -20,20 +20,20 @@ namespace Umbraco.Core.Models.PublishedContent
private readonly Lazy<object> _objectValue;
private readonly Lazy<object> _xpathValue;
public override object GetSourceValue(int? languageId = null, string segment = null)
=> languageId == null & segment == null ? _sourceValue : null;
public override object GetSourceValue(string culture = null, string segment = null)
=> culture == null & segment == null ? _sourceValue : null;
public override bool HasValue(int? languageId = null, string segment = null)
public override bool HasValue(string culture = null, string segment = null)
{
var sourceValue = GetSourceValue(languageId, segment);
var sourceValue = GetSourceValue(culture, segment);
return sourceValue is string s ? !string.IsNullOrWhiteSpace(s) : sourceValue != null;
}
public override object GetValue(int? languageId = null, string segment = null)
=> languageId == null & segment == null ? _objectValue.Value : null;
public override object GetValue(string culture = null, string segment = null)
=> culture == null & segment == null ? _objectValue.Value : null;
public override object GetXPathValue(int? languageId = null, string segment = null)
=> languageId == null & segment == null ? _xpathValue.Value : null;
public override object GetXPathValue(string culture = null, string segment = null)
=> culture == null & segment == null ? _xpathValue.Value : null;
public RawValueProperty(PublishedPropertyType propertyType, IPublishedElement content, object sourceValue, bool isPreviewing = false)
: base(propertyType, PropertyCacheLevel.Unknown) // cache level is ignored