Table of Contents

Class Expression<T>

Namespace
Acuit.Pinpoint.Workflows.Expressions
Assembly
Acuit.Pinpoint.Workflows.dll

A value source that gets its value by evaluating a C# expression.

public class Expression<T> : ValueSource<T>

Type Parameters

T

The value type, which should be compatible with the return value of the C# expression.

Inheritance
Expression<T>
Inherited Members

Remarks

Expressions require an IExpressionEnvironment service to be available in the provided ActivityContext.

Constructors

Expression()

Initializes a new instance of the Expression<T> class.

public Expression()

Expression(string)

Initializes a new instance of the Expression<T> class.

public Expression(string code)

Parameters

code string

The C# expression.

Exceptions

ArgumentNullException

code is null.

Expression(string, string)

Initializes a new instance of the Expression<T> class.

public Expression(string code, string text)

Parameters

code string

The C# expression.

text string

The text to use when this instance is converted to a string via ToString().

Exceptions

ArgumentNullException

code is null.

ArgumentNullException

text is null.

Expression(string, string, IExpressionEnvironment)

Initializes a new instance of the Expression<T> class, immediately compiling the expression.

public Expression(string code, string text, IExpressionEnvironment expressionEnvironment)

Parameters

code string

The C# expression.

text string

The text to use when this instance is converted to a string via ToString().

expressionEnvironment IExpressionEnvironment

The expression environment.

Exceptions

ArgumentNullException

code is null.

ArgumentNullException

text is null.

ArgumentNullException

expressionEnvironment is null.

ArgumentException

code is an empty string.

Exception

There was an error compiling code. Specific exceptions are not documented.

Properties

Code

Gets the C# expression, or an empty string if not set.

public string Code { get; }

Property Value

string

Methods

EvaluateAsync(ActivityContext, CancellationToken)

Evaluates the value.

public override Task<T> EvaluateAsync(ActivityContext context, CancellationToken cancellationToken = default)

Parameters

context ActivityContext

The activity context.

cancellationToken CancellationToken

A token that can request cancelling the evaluation.

Returns

Task<T>

A task that represents the asynchronous operation. The value of its Result property contains the resulting value.

Remarks

This will compile the C# expression in Code if it has not yet been compiled, at which time it requires an IExpressionEnvironment service via context.

Exceptions

ArgumentNullException

context is null.

InvalidOperationException

Code has not been set.

InvalidOperationException

There is no service of type IExpressionEnvironment.

Exception

There was an error compiling Code. Specific exceptions are not documented.

Exception

There was an error executing the compiled Code. Specific exceptions are not documented.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.