namespace Umbraco.Core.Models.PublishedContent { /// /// Provides a fallback strategy for getting values. /// public interface IPublishedValueFallback { /// /// Tries to get a fallback value for a property. /// /// The property. /// The requested culture. /// The requested segment. /// A fallback strategy. /// An optional default value. /// The fallback value. /// A value indicating whether a fallback value could be provided. /// /// This method is called whenever property.Value(culture, segment, defaultValue) is called, and /// property.HasValue(culture, segment) is false. /// It can only fallback at property level (no recurse). /// At property level, property.GetValue() does *not* implement fallback, and one has to /// get property.Value() or property.Value{T}() to trigger fallback. /// Note that and may not be contextualized, /// so the variant context should be used to contextualize them (see our default implementation in /// the web project. /// bool TryGetValue(IPublishedProperty property, string culture, string segment, Fallback fallback, object defaultValue, out object value); /// /// Tries to get a fallback value for a property. /// /// The type of the value. /// The property. /// The requested culture. /// The requested segment. /// A fallback strategy. /// An optional default value. /// The fallback value. /// A value indicating whether a fallback value could be provided. /// /// This method is called whenever property.Value{T}(culture, segment, defaultValue) is called, and /// property.HasValue(culture, segment) is false. /// It can only fallback at property level (no recurse). /// At property level, property.GetValue() does *not* implement fallback, and one has to /// get property.Value() or property.Value{T}() to trigger fallback. /// bool TryGetValue(IPublishedProperty property, string culture, string segment, Fallback fallback, T defaultValue, out T value); /// /// Tries to get a fallback value for a published element property. /// /// The published element. /// The property alias. /// The requested culture. /// The requested segment. /// A fallback strategy. /// An optional default value. /// The fallback value. /// A value indicating whether a fallback value could be provided. /// /// 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. /// It can only fallback at element level (no recurse). /// bool TryGetValue(IPublishedElement content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value); /// /// Tries to get a fallback value for a published element property. /// /// The type of the value. /// The published element. /// The property alias. /// The requested culture. /// The requested segment. /// A fallback strategy. /// An optional default value. /// The fallback value. /// A value indicating whether a fallback value could be provided. /// /// 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. /// It can only fallback at element level (no recurse). /// bool TryGetValue(IPublishedElement content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value); /// /// Tries to get a fallback value for a published content property. /// /// The published element. /// The property alias. /// The requested culture. /// The requested segment. /// A fallback strategy. /// An optional default value. /// The fallback value. /// The property that does not have a value. /// A value indicating whether a fallback value could be provided. /// /// 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. /// In an , 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 /// 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". /// bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, object defaultValue, out object value, out IPublishedProperty noValueProperty); /// /// Tries to get a fallback value for a published content property. /// /// The type of the value. /// The published element. /// The property alias. /// The requested culture. /// The requested segment. /// A fallback strategy. /// An optional default value. /// The fallback value. /// The property that does not have a value. /// A value indicating whether a fallback value could be provided. /// /// 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. /// In an , 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 /// 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". /// bool TryGetValue(IPublishedContent content, string alias, string culture, string segment, Fallback fallback, T defaultValue, out T value, out IPublishedProperty noValueProperty); } }