Assembly: OptimaJet.Workflow.Core

Class ExpressionsCompiler

OptimaJet.Workflow.Core.CodeActions.ExpressionsCompiler

Prepares and compiles transition expression conditions and subprocess-name values into asynchronous delegates evaluated against ProcessInstance objects.

public static class ExpressionsCompiler

Properties

public static bool CompilationEnable { get; set; } #
Gets or sets whether workflow expression compilation is enabled.

Remarks

This static setting applies process-wide.
public static ExpressionsCompilerOptions Options { get; set; } #
Gets or sets the ExpressionsCompilerOptions used during expression compilation.

Remarks

This static setting applies process-wide.

Methods

public static void RegisterAssembly(Assembly assembly) #
Adds the namespaces used by types in an Assembly to the imports available to subsequently compiled expressions.

Parameters

Name
Type
Description
assembly
Assembly
The assembly whose distinct namespace names are added to the import set.

Exceptions

Type
Description
ReflectionTypeLoadException
Thrown when one or more types from assembly cannot be loaded.

Remarks

Registration applies process-wide. This method adds namespace imports but does not add an assembly metadata reference to the compiler.
public static ExpressionsInvoker CompileExpressions(ProcessDefinition processDefinition) #
Compiles the ConditionType.Expression conditions in a process scheme into one Boolean delegate per transition, keyed by the transition name.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition
The process scheme whose transition expressions are compiled.

Returns

Type
Description
ExpressionsInvoker
An ExpressionsInvoker containing the compiled transition delegates. The invoker is empty when expression compilation is disabled or the scheme contains no expression conditions.

Exceptions

Type
Description
Exception
Thrown when an applicable transition expression cannot be compiled.

Remarks

Multiple expression conditions on the same transition are combined according to TransitionDefinition.ConditionsConcatenationType. The compiler also applies ConditionDefinition.ConditionInversion and ConditionDefinition.ResultOnPreExecution before combining the conditions.
public static SubprocessNameGetterInvoker CompileSubprocessNameGetters(ProcessDefinition processDefinition) #
Compiles a subprocess-name delegate for each transition whose TransitionDefinition.SubprocessName is not blank.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition
The process scheme whose subprocess-name values are compiled.

Returns

Type
Description
SubprocessNameGetterInvoker
A SubprocessNameGetterInvoker containing delegates keyed by transition name. The invoker is empty when expression compilation is disabled or no transition has a nonblank subprocess name.

Remarks

Each configured value is first prepared and compiled as an expression that returns a subprocess name. If compilation fails, the prepared text is used as a literal name instead. Exceptions raised later while evaluating a successfully compiled expression are propagated.

Remarks

Before compilation, recognized workflow operators and process-parameter references are converted to C# expression syntax.