Published variants - WIP

This commit is contained in:
Stephan
2017-12-06 11:51:35 +01:00
parent 995f47e6d9
commit b392d72bc2
21 changed files with 169 additions and 180 deletions

View File

@@ -89,7 +89,7 @@ namespace Umbraco.Web.PublishedCache.NuCache.Navigable
throw new ArgumentOutOfRangeException(nameof(index));
// custom property, ie element
return properties[index].XPathValue;
return properties[index].GetXPathValue();
}
#endregion

View File

@@ -54,7 +54,7 @@ namespace Umbraco.Web.PublishedCache.NuCache
_publishedSnapshotAccessor = origin._publishedSnapshotAccessor;
}
public override bool HasValue => _sourceValue != null
public override bool HasValue(int? languageId = null, string segment = null) => _sourceValue != null
&& (!(_sourceValue is string) || string.IsNullOrWhiteSpace((string) _sourceValue) == false);
private class CacheValues
@@ -129,39 +129,33 @@ namespace Umbraco.Web.PublishedCache.NuCache
return _interValue;
}
public override object SourceValue => _sourceValue;
public override object GetSourceValue(int? languageId = null, string segment = null) => _sourceValue;
public override object Value
public override object GetValue(int? languageId = null, string segment = null)
{
get
lock (_locko)
{
lock (_locko)
{
var cacheValues = GetCacheValues(PropertyType.CacheLevel);
if (cacheValues.ObjectInitialized) return cacheValues.ObjectValue;
var cacheValues = GetCacheValues(PropertyType.CacheLevel);
if (cacheValues.ObjectInitialized) return cacheValues.ObjectValue;
// initial reference cache level always is .Content
cacheValues.ObjectValue = PropertyType.ConvertInterToObject(_content, PropertyCacheLevel.Element, GetInterValue(), _isPreviewing);
cacheValues.ObjectInitialized = true;
return cacheValues.ObjectValue;
}
// initial reference cache level always is .Content
cacheValues.ObjectValue = PropertyType.ConvertInterToObject(_content, PropertyCacheLevel.Element, GetInterValue(), _isPreviewing);
cacheValues.ObjectInitialized = true;
return cacheValues.ObjectValue;
}
}
public override object XPathValue
public override object GetXPathValue(int? languageId = null, string segment = null)
{
get
lock (_locko)
{
lock (_locko)
{
var cacheValues = GetCacheValues(PropertyType.CacheLevel);
if (cacheValues.XPathInitialized) return cacheValues.XPathValue;
var cacheValues = GetCacheValues(PropertyType.CacheLevel);
if (cacheValues.XPathInitialized) return cacheValues.XPathValue;
// initial reference cache level always is .Content
cacheValues.XPathValue = PropertyType.ConvertInterToXPath(_content, PropertyCacheLevel.Element, GetInterValue(), _isPreviewing);
cacheValues.XPathInitialized = true;
return cacheValues.XPathValue;
}
// initial reference cache level always is .Content
cacheValues.XPathValue = PropertyType.ConvertInterToXPath(_content, PropertyCacheLevel.Element, GetInterValue(), _isPreviewing);
cacheValues.XPathInitialized = true;
return cacheValues.XPathValue;
}
}
}