Assembly: OptimaJet.Workflow.Core

Class ExpressionManager

OptimaJet.Workflow.Core.CodeActions.ExpressionManager

Compiles, caches, and evaluates workflow expressions for process schemes.

public sealed class ExpressionManager

Methods

public Task<TResult> CompileIfNotContainsAndInvokeAsync<TResult>(ProcessInstance processInstance, string expressionString, bool ignoreExceptions, string functionName) #
Prepares, compiles, and caches expressionString for TResult when the corresponding cache entry does not exist, then evaluates the cached delegate against processInstance.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process instance whose scheme is used when the expression is first compiled and which is supplied as the execution context whenever the cached expression is evaluated.
expressionString
String
The workflow expression to compile and evaluate. Workflow operators and process-parameter references are converted to their C# equivalents before compilation.
ignoreExceptions
Boolean
true to use the prepared expression text converted to TResult as a fallback when compilation fails; false to propagate the compilation error.
functionName
String
A compatibility label passed to the expression compiler. The current compiler does not use its value.

Returns

Type
Description
Task<TResult>
The TResult value produced by the cached or newly compiled delegate.

Exceptions

Type
Description
Exception
Thrown when expression compilation fails and ignoreExceptions is false. Exceptions raised while evaluating the expression or converting the fallback value are also propagated.

Remarks

The cache key consists of the exact expressionString value and TResult. Once that entry is cached, subsequent calls reuse it regardless of the supplied ignoreExceptions and functionName values. ExpressionsCompiler.CompilationEnable must be true when a new expression needs to be compiled.

Remarks

The runtime creates an ExpressionManager for each non-subprocess process scheme. Expressions used by a subprocess are compiled and cached by the manager associated with its root process scheme.