Class DefaultExecutionContext<T>
- Namespace
- Albatross.Expression.Context
- Assembly
- Albatross.Expression.dll
Default implementation of execution context that maintains an in-memory store of variable values. Provides case-sensitive or case-insensitive variable lookups based on parser configuration.
public class DefaultExecutionContext<T> : ExecutionContext<T>, IExecutionContext<T>
Type Parameters
TThe type of the root context object.
- Inheritance
-
DefaultExecutionContext<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
DefaultExecutionContext(IParser)
Initializes a new instance of the DefaultExecutionContext class. Creates an internal dictionary with case-sensitivity matching the parser's configuration.
public DefaultExecutionContext(IParser parser)
Parameters
parserIParserThe parser instance that determines case-sensitivity settings.
Properties
Store
Gets the internal dictionary that stores variable names and their corresponding context values.
public Dictionary<string, IContextValue<T>> Store { get; }
Property Value
Methods
Clear()
Removes all variables from the execution context store.
public void Clear()
Set(IContextValue<T>)
Adds or updates a context value in the execution context store.
public void Set(IContextValue<T> value)
Parameters
valueIContextValue<T>The context value to add or update.
TryGetValueHandler(string, out IContextValue<T>?)
Attempts to retrieve a context value from the internal store by name.
protected override bool TryGetValueHandler(string name, out IContextValue<T>? value)
Parameters
namestringThe name of the variable to look up.
valueIContextValue<T>When this method returns, contains the context value if found, or null if not found.
Returns
- bool
true if the variable was found in the store; otherwise, false.