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) #

Compiles an expression if necessary, then evaluates it against the supplied process.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process supplying scheme context and current parameter values.
expressionString
String
The original workflow expression.
ignoreExceptions
Boolean
Whether built-in compilation can fall back to a literal. External compiler errors always reach the caller.
functionName
String
The diagnostic function label, also used as the source name.

Returns

Type
Description
Task<TResult>
The value produced by the compiled function.

Remarks

This overload uses ExpressionCompilationPurpose.Custom. Disabling compilation prevents new cache entries. Cached functions can still run if the compiler registration has not changed.

public Task<TResult> CompileIfNotContainsAndInvokeAsync<TResult>(ProcessInstance processInstance, string expressionString, bool ignoreExceptions, string functionName, ExpressionCompilationPurpose purpose, string sourceName) #

Compiles and evaluates an expression with an explicit workflow purpose and source name.

Parameters

Name
Type
Description
processInstance
ProcessInstance
The process supplying scheme context and current parameter values.
expressionString
String
The original workflow expression.
ignoreExceptions
Boolean
Whether built-in compilation can fall back to a literal. External compiler errors always reach the caller.
functionName
String
The diagnostic function label.
purpose
ExpressionCompilationPurpose
The workflow feature requesting compilation.
sourceName
String
The source name used in error messages. It does not grant access to data or code.

Returns

Type
Description
Task<TResult>
The value produced by the compiled function.

Exceptions

Type
Description
InvalidOperationException
Compilation is disabled, failed, or the compiler registration changed.

Remarks

A root scheme and its subprocesses share a manager. The manager reuses a function when the full compilation request and compiler registration match a cached entry. Concurrent identical requests share one successful compilation. Failed compilations can be retried. The function reads current process values on each call.