Table of Contents

Class ExecutionContext<T>

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

Abstract base class for execution contexts that provide variable resolution and evaluation capabilities. Manages variable lookups, circular reference detection, and both synchronous and asynchronous evaluation.

public abstract class ExecutionContext<T> : IExecutionContext<T>

Type Parameters

T

The type of the root context object.

Inheritance
ExecutionContext<T>
Implements
Derived
Inherited Members
Extension Methods

Constructors

ExecutionContext(IParser)

Initializes a new instance of the ExecutionContext class.

protected ExecutionContext(IParser parser)

Parameters

parser IParser

The parser instance used for expression parsing and case-sensitivity settings.

Properties

Parser

Gets the parser instance associated with this execution context.

public IParser Parser { get; }

Property Value

IParser

Methods

GetValue(string, T)

Gets the value of a variable by name from the execution context. Throws an exception if the variable is not found.

public object GetValue(string name, T input)

Parameters

name string

The name of the variable to retrieve.

input T

The root context object.

Returns

object

The value of the variable.

Exceptions

MissingVariableException

Thrown when the variable is not found in the context.

GetValueAsync(string, T)

Asynchronously gets the value of a variable by name from the execution context. Includes circular reference detection for expression-based context values.

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

Parameters

name string

The name of the variable to retrieve.

input T

The root context object.

Returns

Task<object>

A task containing the variable value.

Exceptions

MissingVariableException

Thrown when the variable is not found in the context.

TryGetValue(string, T, out object?)

Attempts to get the value of a variable by name from the execution context. Includes circular reference detection for expression-based context values.

public bool TryGetValue(string name, T input, out object? data)

Parameters

name string

The name of the variable to retrieve.

input T

The root context object.

data object

When this method returns, contains the variable value if found, or null if not found.

Returns

bool

true if the variable was found and evaluated successfully; otherwise, false.

TryGetValueHandler(string, out IContextValue<T>?)

Abstract method that derived classes must implement to provide variable lookup logic.

protected abstract bool TryGetValueHandler(string name, out IContextValue<T>? value)

Parameters

name string

The name of the variable to look up.

value IContextValue<T>

When this method returns, contains the context value if found, or null if not found.

Returns

bool

true if the variable was found; otherwise, false.