Class NoopPublishedValueFallback
Provides a noop implementation for IPublishedValueFallback.
Inheritance
Namespace: Umbraco.Cms.Core.Models.PublishedContent
Assembly: Umbraco.Core.dll
Syntax
public class NoopPublishedValueFallback : IPublishedValueFallback
Remarks
This is for tests etc - does not implement fallback at all.
Methods
View SourceTryGetValue(IPublishedContent, string, string?, string?, Fallback, object?, out object?, out IPublishedProperty?)
Tries to get a fallback value for a published content property.
Declaration
public bool TryGetValue(IPublishedContent content, string alias, string? culture, string? segment, Fallback fallback, object? defaultValue, out object? value, out IPublishedProperty? noValueProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The published element. |
| string | alias | The property alias. |
| string | culture | The requested culture. |
| string | segment | The requested segment. |
| Fallback | fallback | A fallback strategy. |
| object | defaultValue | An optional default value. |
| object | value | The fallback value. |
| IPublishedProperty | noValueProperty | The property that does not have a value. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether a fallback value could be provided. |
Remarks
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 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
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".
TryGetValue(IPublishedElement, string, string?, string?, Fallback, object?, out object?)
Tries to get a fallback value for a published element property.
Declaration
public bool TryGetValue(IPublishedElement content, string alias, string? culture, string? segment, Fallback fallback, object? defaultValue, out object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedElement | content | The published element. |
| string | alias | The property alias. |
| string | culture | The requested culture. |
| string | segment | The requested segment. |
| Fallback | fallback | A fallback strategy. |
| object | defaultValue | An optional default value. |
| object | value | The fallback value. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether a fallback value could be provided. |
Remarks
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).
TryGetValue(IPublishedProperty, string?, string?, Fallback, object?, out object?)
Tries to get a fallback value for a property.
Declaration
public bool TryGetValue(IPublishedProperty property, string? culture, string? segment, Fallback fallback, object? defaultValue, out object? value)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedProperty | property | The property. |
| string | culture | The requested culture. |
| string | segment | The requested segment. |
| Fallback | fallback | A fallback strategy. |
| object | defaultValue | An optional default value. |
| object | value | The fallback value. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether a fallback value could be provided. |
Remarks
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 culture and segment may not be contextualized,
so the variant context should be used to contextualize them (see our default implementation in
the web project.
TryGetValue<T>(IPublishedContent, string, string?, string?, Fallback, T, out T?, out IPublishedProperty?)
Tries to get a fallback value for a published content property.
Declaration
public bool TryGetValue<T>(IPublishedContent content, string alias, string? culture, string? segment, Fallback fallback, T defaultValue, out T? value, out IPublishedProperty? noValueProperty)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedContent | content | The published element. |
| string | alias | The property alias. |
| string | culture | The requested culture. |
| string | segment | The requested segment. |
| Fallback | fallback | A fallback strategy. |
| T | defaultValue | An optional default value. |
| T | value | The fallback value. |
| IPublishedProperty | noValueProperty | The property that does not have a value. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether a fallback value could be provided. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value. |
Remarks
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 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
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".
TryGetValue<T>(IPublishedElement, string, string?, string?, Fallback, T?, out T?)
Tries to get a fallback value for a published element property.
Declaration
public bool TryGetValue<T>(IPublishedElement content, string alias, string? culture, string? segment, Fallback fallback, T? defaultValue, out T? value)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedElement | content | The published element. |
| string | alias | The property alias. |
| string | culture | The requested culture. |
| string | segment | The requested segment. |
| Fallback | fallback | A fallback strategy. |
| T | defaultValue | An optional default value. |
| T | value | The fallback value. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether a fallback value could be provided. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value. |
Remarks
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).
TryGetValue<T>(IPublishedProperty, string?, string?, Fallback, T?, out T?)
Tries to get a fallback value for a property.
Declaration
public bool TryGetValue<T>(IPublishedProperty property, string? culture, string? segment, Fallback fallback, T? defaultValue, out T? value)
Parameters
| Type | Name | Description |
|---|---|---|
| IPublishedProperty | property | The property. |
| string | culture | The requested culture. |
| string | segment | The requested segment. |
| Fallback | fallback | A fallback strategy. |
| T | defaultValue | An optional default value. |
| T | value | The fallback value. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether a fallback value could be provided. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the value. |
Remarks
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.