# Class ExpressionManager OptimaJet.Workflow.Core.CodeActions.ExpressionManager Compiles, caches, and evaluates workflow expressions for process schemes. Namespace: [OptimaJet.Workflow.Core.CodeActions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/) ```csharp public sealed class ExpressionManager ``` ## Methods `public Task CompileIfNotContainsAndInvokeAsync(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](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to use the prepared expression text converted to `TResult` as a fallback when compilation fails; [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) 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` | The `TResult` value produced by the cached or newly compiled delegate. | ### Exceptions | Type | Description | | --- | --- | | `Exception` | Thrown when expression compilation fails and `ignoreExceptions` is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/ExpressionsCompiler/) must be [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when a new expression needs to be compiled. ## Remarks The runtime creates an [ExpressionManager](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/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. [Previous CodeForCompillation](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeForCompillation/) [Next ExpressionsCompiler](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/ExpressionsCompiler/)