Merge remote-tracking branch 'origin/v8/dev' into v9/dev
# Conflicts: # src/SolutionInfo.cs # src/Umbraco.Core/Cache/DataTypeCacheRefresher.cs # src/Umbraco.Core/Extensions/PublishedContentExtensions.cs # src/Umbraco.Core/Extensions/PublishedPropertyExtension.cs # src/Umbraco.Core/Migrations/Install/DatabaseDataCreator.cs # src/Umbraco.Tests/TestHelpers/Entities/MockedContentTypes.cs # src/Umbraco.Web.UI.NetCore/umbraco/config/lang/da.xml # src/Umbraco.Web/PropertyEditors/MediaPickerPropertyEditor.cs
This commit is contained in:
@@ -262,7 +262,7 @@ namespace Umbraco.Extensions
|
||||
|
||||
// else... if we have a property, at least let the converter return its own
|
||||
// vision of 'no value' (could be an empty enumerable) - otherwise, default
|
||||
return property == null ? default : property.Value<T>(publishedValueFallback, culture, segment, fallback, defaultValue);
|
||||
return property == null ? default : property.Value<T>(publishedValueFallback, culture, segment);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -32,16 +32,9 @@ namespace Umbraco.Extensions
|
||||
// we have a value
|
||||
// try to cast or convert it
|
||||
var value = property.GetValue(culture, segment);
|
||||
if (value is T valueAsT)
|
||||
{
|
||||
return valueAsT;
|
||||
}
|
||||
|
||||
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
|
||||
@@ -50,28 +43,14 @@ namespace Umbraco.Extensions
|
||||
|
||||
// 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 == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
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