Class ExpressionContextWrappingDecorator
A decorator class for the IGetsValueFromObject service, which detects instances of ExpressionContext and wraps them with an instance of NamedTalesValueForExpressionContextAdapter, so that subsequent classes in the decorator/chain may treat them as IGetsNamedTalesValue.
Inheritance
Implements
Inherited Members
Namespace: ZptSharp.Expressions.PathExpressions
Assembly: ZptSharp.dll
Syntax
public class ExpressionContextWrappingDecorator : IGetsValueFromObject
Constructors
| Improve this Doc View SourceExpressionContextWrappingDecorator(RenderingConfig, IGetsBuiltinContextsProvider, IGetsValueFromObject)
Initializes a new instance of the ExpressionContextWrappingDecorator class.
Declaration
public ExpressionContextWrappingDecorator(RenderingConfig config, IGetsBuiltinContextsProvider builtinContextsProviderFactory, IGetsValueFromObject wrapped)
Parameters
Type | Name | Description |
---|---|---|
RenderingConfig | config | Config. |
IGetsBuiltinContextsProvider | builtinContextsProviderFactory | Builtin contexts provider factory. |
IGetsValueFromObject | wrapped | Wrapped. |
Methods
| Improve this Doc View SourceTryGetValueAsync(String, Object, CancellationToken)
Returns the result from the wrapped service. If the object
parameter is an
instance of ExpressionContext then it is substituted in the call to the wrapped
service with an instance of NamedTalesValueForExpressionContextAdapter wrapping
the original context.
Declaration
public Task<GetValueResult> TryGetValueAsync(string name, object object, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The value name. |
System.Object | object | The object from which to retrieve the value. |
System.Threading.CancellationToken | cancellationToken | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<GetValueResult> | An object indicating whether a value was successfully retrieved or not, along with the retrieved value (if applicable). |