Misc fixes for PR and Fallback

This commit is contained in:
Stephan
2019-01-21 14:27:11 +01:00
parent d4664fbae6
commit ee0c868687
4 changed files with 56 additions and 104 deletions

View File

@@ -94,12 +94,17 @@
/// <param name="fallback">A fallback strategy.</param>
/// <param name="defaultValue">An optional default value.</param>
/// <param name="value">The fallback value.</param>
/// <param name="noValueProperty">The property that does not have a value.</param>
/// <returns>A value indicating whether a fallback value could be provided.</returns>
/// <remarks>
/// <para>This method is called whenever getting the property value for the specified alias, culture and
/// segment, either returned no property at all, or a property with HasValue(culture, segment) being false.</para>
/// <para>In an <see cref="IPublishedContent"/>, because walking up the tree is possible, the content itself may not even
/// have a property with the specified alias, but such a property may exist up in the tree. The <paramref name="noValueProperty"/>
/// parameter is used to return a property with no value. That can then be used to invoke a converter and get the
/// converter's interpretation of "no value".</para>
/// </remarks>
bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value);
bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value, out IPublishedProperty noValueProperty);
/// <summary>
/// Tries to get a fallback value for a published content property.
@@ -117,6 +122,6 @@
/// <para>This method is called whenever getting the property value for the specified alias, culture and
/// segment, either returned no property at all, or a property with HasValue(culture, segment) being false.</para>
/// </remarks>
bool TryGetValue<T>(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value);
bool TryGetValue<T>(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value, out IPublishedProperty noValueProperty);
}
}

View File

@@ -37,16 +37,18 @@
}
/// <inheritdoc />
public bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value)
public bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value, out IPublishedProperty noValueProperty)
{
value = default;
noValueProperty = default;
return false;
}
/// <inheritdoc />
public bool TryGetValue<T>(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value)
public bool TryGetValue<T>(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value, out IPublishedProperty noValueProperty)
{
value = default;
noValueProperty = default;
return false;
}
}