Table of Contents

Class CodeScript

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

A C# script.

[TypeConverter(typeof(CodeScriptTypeConverter))]
public class CodeScript
Inheritance
CodeScript
Inherited Members

Constructors

CodeScript(string)

Initializes a new instance of the CodeScript class.

public CodeScript(string code)

Parameters

code string

The C# script.

Exceptions

ArgumentNullException

code is null.

CodeScript(string, IExpressionEnvironment)

Initializes a new instance of the CodeScript class, immediately compiling the script.

public CodeScript(string code, IExpressionEnvironment expressionEnvironment)

Parameters

code string

The C# script.

expressionEnvironment IExpressionEnvironment

The expression environment.

Exceptions

ArgumentNullException

code is null.

ArgumentNullException

expressionEnvironment is null.

Exception

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

Properties

Code

Gets the C# script.

public string Code { get; }

Property Value

string

Methods

ExecuteAsync(ActivityContext, CancellationToken)

Executes the C# script and returns the result.

public Task<object?> ExecuteAsync(ActivityContext context, CancellationToken cancellationToken = default)

Parameters

context ActivityContext

The activity context.

cancellationToken CancellationToken

A token that can request cancelling the execution.

Returns

Task<object>

The task object representing the asynchronous operation.

Remarks

Once the operation completes, the Result property on the returned task object contains the value returned by the script, or null if the script did not return a value.

This will compile the C# script 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

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.

Operators

implicit operator CodeScript(string)

Defines an implicit conversion of a string to a CodeScript.

public static implicit operator CodeScript(string code)

Parameters

code string

The C# script.

Returns

CodeScript