# Class CodeActionsCompiller OptimaJet.Workflow.Core.CodeActions.CodeActionsCompiller Compiles scheme and global [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) objects into [CodeActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsInvoker/) instances. Namespace: [OptimaJet.Workflow.Core.CodeActions](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/) ```csharp public static class CodeActionsCompiller ``` ## Properties `public static IExternalCompiler ExternalCompiler { get; set; }` Gets or sets the external compiler used for code-action compilation. ### Remarks When this property is set, compilation methods delegate to [IExternalCompiler](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/IExternalCompiler/) instead of the built-in Roslyn pipeline. `public static bool CompillationEnable { get; set; }` Gets or sets whether dynamic code-action compilation is enabled. `public static bool DebugMode { get; set; }` Gets or sets whether debug code-action compilation is requested. ### Remarks With the built-in compiler, [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) enables debug optimization, expands `/*break*/` markers, and writes generated `.cs`, `.dll`, and `.pdb` files to the system temporary directory. An [IExternalCompiler](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/IExternalCompiler/) receives the value as its debug-compilation request. The default is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). `public static IEnumerable Usings { get; }` Gets namespace names registered for code-action compilation. `public static IEnumerable Locations { get; }` Gets assembly file locations supplied as metadata references during compilation. ## Methods `public static void RegisterAssembly(string longName)` Loads an assembly by name and adds its file location and namespace names to the compiler registries. ### Parameters | Name | Type | Description | | --- | --- | --- | | `longName` | `String` | The assembly display name passed to [AssemblyName](https://learn.microsoft.com/dotnet/api/system.reflection.assemblyname). | `public static void RegisterAssembly(Assembly assembly)` Adds an assembly file location and its namespace names to the compiler registries. ### Parameters | Name | Type | Description | | --- | --- | --- | | `assembly` | `Assembly` | The assembly to register. [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) and assemblies without a file location are ignored. | `public static CodeActionsInvoker CompileCodeActions(ProcessDefinition processDefinition, Guid schemeId)` Compiles code actions from a [ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) and returns a [CodeActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsInvoker/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processDefinition` | `ProcessDefinition` | The [ProcessDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessDefinition/) whose [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) list is compiled. | | `schemeId` | `Guid` | The [Guid](https://learn.microsoft.com/dotnet/api/system.guid) used when building the generated namespace. | ### Returns | Type | Description | | --- | --- | | `CodeActionsInvoker` | An invoker containing the compiled code actions, or an empty invoker when no code actions are defined or [CodeActionsCompiller.CompillationEnable](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsCompiller/) is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Exceptions | Type | Description | | --- | --- | | `InvalidOperationException` | Thrown by the built-in compiler when one or more code actions cannot be compiled. | `public static CodeActionsInvoker CompileGlobalCodeActions(List codeActionDefinitions, bool ignoreNotCompilled, out Dictionary compileErrors)` Compiles global code actions and returns a [CodeActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsInvoker/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `codeActionDefinitions` | `List` | The global [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) instances to compile. | | `ignoreNotCompilled` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to omit individual code actions that fail to compile and return the remaining actions; [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to fail on any compilation error. | | `compileErrors` | `Dictionary` | When this method returns, contains diagnostics for omitted code actions keyed by code-action type and name; empty when no errors were ignored. | ### Returns | Type | Description | | --- | --- | | `CodeActionsInvoker` | An invoker for the successfully compiled global code actions, or an empty invoker when the input is empty or [CodeActionsCompiller.CompillationEnable](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsCompiller/) is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Exceptions | Type | Description | | --- | --- | | `InvalidOperationException` | Thrown by the built-in compiler when `ignoreNotCompilled` is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool), an error cannot be attributed to one code action, or compilation still fails after invalid actions are omitted. | `public static CodeActionsInvoker CompileCodeActions(string commonUsings, List codeActionDefinitions, string namespaceName)` Compiles code actions with explicit common namespace imports and a generated namespace postfix. ### Parameters | Name | Type | Description | | --- | --- | --- | | `commonUsings` | `String` | Semicolon-separated namespace imports shared by the code actions. | | `codeActionDefinitions` | `List` | The [CodeActionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) instances to compile. | | `namespaceName` | `String` | The postfix used to create the generated namespace. | ### Returns | Type | Description | | --- | --- | | `CodeActionsInvoker` | An invoker containing the compiled code actions, or an empty invoker when no actions are supplied or [CodeActionsCompiller.CompillationEnable](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsCompiller/) is [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Exceptions | Type | Description | | --- | --- | | `InvalidOperationException` | Thrown by the built-in compiler when one or more code actions cannot be compiled. | ## Fields `public static List DefaultUsings` The base namespace imports considered when generated code-action source is created. ### Remarks A code-action definition can add imports through [CodeActionDefinition.Usings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/) or remove imports through [CodeActionDefinition.ExcludedUsings](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CodeActionDefinition/). [Previous IParsedProcessCache](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Cache/IParsedProcessCache/) [Next CodeActionsInvoker](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.CodeActions/CodeActionsInvoker/)