Table of Contents

Class ExternalContextValue<T>

Namespace
Albatross.Expression.Context
Assembly
Albatross.Expression.dll

Context value that delegates value retrieval to an external function. Computes the value dynamically based on the input context using the provided function.

public class ExternalContextValue<T> : IContextValue<T>

Type Parameters

T

The type of the root context object.

Inheritance
ExternalContextValue<T>
Implements
Inherited Members
Extension Methods

Constructors

ExternalContextValue(string, Func<T, object>)

Initializes a new instance of the ExternalContextValue class with a value computation function.

public ExternalContextValue(string name, Func<T, object> func)

Parameters

name string

The name of this context value.

func Func<T, object>

The function that computes the value based on the input context.

Properties

Name

Gets the name of this context value.

public string Name { get; }

Property Value

string

Methods

GetValue(T, Func<string, T, object>)

Computes and returns the value by invoking the external function with the input context. Ignores the variable resolution function parameter since this value doesn't depend on other variables.

public object GetValue(T input, Func<string, T, object> _)

Parameters

input T

The root context object passed to the computation function.

_ Func<string, T, object>

Function to resolve variables (ignored).

Returns

object

The result of invoking the computation function with the input context.

GetValueAsync(T, Func<string, T, Task<object>>)

Asynchronously computes and returns the value by invoking the external function with the input context. Returns a completed task since the computation is synchronous.

public Task<object> GetValueAsync(T input, Func<string, T, Task<object>> _)

Parameters

input T

The root context object passed to the computation function.

_ Func<string, T, Task<object>>

Async function to resolve variables (ignored).

Returns

Task<object>

A completed task containing the result of the computation function.