fix build, re-adds braces after merge
This commit is contained in:
@@ -13,12 +13,10 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
{
|
||||
public IDictionary<string, PropertyData[]> ReadFrom(Stream stream)
|
||||
{
|
||||
|
||||
// read properties count
|
||||
var pcount = PrimitiveSerializer.Int32.ReadFrom(stream);
|
||||
var pcount = PrimitiveSerializer.Int32.ReadFrom(stream);
|
||||
var dict = new Dictionary<string, PropertyData[]>(pcount,StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
var dict = new Dictionary<string, PropertyData[]>(pcount,StringComparer.InvariantCultureIgnoreCase);
|
||||
// read each property
|
||||
for (var i = 0; i < pcount; i++)
|
||||
{
|
||||
|
||||
@@ -36,10 +36,17 @@ namespace Umbraco.Web
|
||||
{
|
||||
// we have a value
|
||||
// try to cast or convert it
|
||||
var value = property.GetValue(culture, segment);
|
||||
if (value is T valueAsT) return valueAsT;
|
||||
var value = property.GetValue(culture, segment);
|
||||
if (value is T valueAsT)
|
||||
{
|
||||
return valueAsT;
|
||||
}
|
||||
|
||||
var valueConverted = value.TryConvertTo<T>();
|
||||
if (valueConverted) return valueConverted.Result;
|
||||
if (valueConverted)
|
||||
{
|
||||
return valueConverted.Result;
|
||||
}
|
||||
|
||||
// cannot cast nor convert the value, nothing we can return but 'default'
|
||||
// note: we don't want to fallback in that case - would make little sense
|
||||
@@ -48,14 +55,23 @@ namespace Umbraco.Web
|
||||
|
||||
// we don't have a value, try fallback
|
||||
if (PublishedValueFallback.TryGetValue(property, culture, segment, fallback, defaultValue, out var fallbackValue))
|
||||
{
|
||||
return fallbackValue;
|
||||
}
|
||||
|
||||
// we don't have a value - neither direct nor fallback
|
||||
// give a chance to the converter to return something (eg empty enumerable)
|
||||
var noValue = property.GetValue(culture, segment);
|
||||
if (noValue is T noValueAsT) return noValueAsT;
|
||||
if (noValue is T noValueAsT)
|
||||
{
|
||||
return noValueAsT;
|
||||
}
|
||||
|
||||
var noValueConverted = noValue.TryConvertTo<T>();
|
||||
if (noValueConverted) return noValueConverted.Result;
|
||||
if (noValueConverted)
|
||||
{
|
||||
return noValueConverted.Result;
|
||||
}
|
||||
|
||||
// cannot cast noValue nor convert it, nothing we can return but 'default'
|
||||
return default;
|
||||
|
||||
Reference in New Issue
Block a user