# Class ExpressionsCompiler OptimaJet.Workflow.Core.CodeActions.ExpressionsCompiler Prepares and compiles transition expression conditions and subprocess-name values into asynchronous delegates evaluated against [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects. Namespace: [OptimaJet.Workflow.Core.CodeActions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/) ```csharp 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/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](https://learn.microsoft.com/dotnet/api/system.reflection.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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ConditionType/) 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/). The compiler also applies [ConditionDefinition.ConditionInversion](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ConditionDefinition/) and [ConditionDefinition.ResultOnPreExecution](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ConditionDefinition/) before combining the conditions. `public static SubprocessNameGetterInvoker CompileSubprocessNameGetters(ProcessDefinition processDefinition)` Compiles a subprocess-name delegate for each transition whose [TransitionDefinition.SubprocessName](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TransitionDefinition/) is not blank. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processDefinition` | `ProcessDefinition` | The process scheme whose subprocess-name values are compiled. | ### Returns | Type | Description | | --- | --- | | `SubprocessNameGetterInvoker` | A [SubprocessNameGetterInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/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. [Previous ExpressionManager](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/ExpressionManager/) [Next ExpressionsCompilerOptions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/ExpressionsCompilerOptions/)