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
codestringThe C# script.
Exceptions
- ArgumentNullException
codeis null.
CodeScript(string, IExpressionEnvironment)
Initializes a new instance of the CodeScript class, immediately compiling the script.
public CodeScript(string code, IExpressionEnvironment expressionEnvironment)
Parameters
codestringThe C# script.
expressionEnvironmentIExpressionEnvironmentThe expression environment.
Exceptions
- ArgumentNullException
codeis null.- ArgumentNullException
expressionEnvironmentis 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
Methods
ExecuteAsync(ActivityContext, CancellationToken)
Executes the C# script and returns the result.
public Task<object?> ExecuteAsync(ActivityContext context, CancellationToken cancellationToken = default)
Parameters
contextActivityContextThe activity context.
cancellationTokenCancellationTokenA token that can request cancelling the execution.
Returns
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
contextis 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
codestringThe C# script.