Assembly: OptimaJet.Workflow.Core

Class CodeActionsCompiller

OptimaJet.Workflow.Core.CodeActions.CodeActionsCompiller

Compiles scheme and global CodeActionDefinition objects into CodeActionsInvoker instances.

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 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 enables debug optimization, expands /*break*/ markers, and writes generated .cs, .dll, and .pdb files to the system temporary directory. An IExternalCompiler receives the value as its debug-compilation request. The default is false.
public static IEnumerable<string> Usings { get; } #
Gets namespace names registered for code-action compilation.
public static IEnumerable<string> 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.
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 and assemblies without a file location are ignored.
public static CodeActionsInvoker CompileCodeActions(ProcessDefinition processDefinition, Guid schemeId) #
Compiles code actions from a ProcessDefinition and returns a CodeActionsInvoker.

Parameters

Name
Type
Description
processDefinition
ProcessDefinition
The ProcessDefinition whose CodeActionDefinition list is compiled.
schemeId
Guid
The 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 is false.

Exceptions

Type
Description
InvalidOperationException
Thrown by the built-in compiler when one or more code actions cannot be compiled.
public static CodeActionsInvoker CompileGlobalCodeActions(List<CodeActionDefinition> codeActionDefinitions, bool ignoreNotCompilled, out Dictionary<string, string> compileErrors) #
Compiles global code actions and returns a CodeActionsInvoker.

Parameters

Name
Type
Description
codeActionDefinitions
List<CodeActionDefinition>
The global CodeActionDefinition instances to compile.
ignoreNotCompilled
Boolean
true to omit individual code actions that fail to compile and return the remaining actions; false to fail on any compilation error.
compileErrors
Dictionary<String, String>
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 is false.

Exceptions

Type
Description
InvalidOperationException
Thrown by the built-in compiler when ignoreNotCompilled is false, 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<CodeActionDefinition> 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<CodeActionDefinition>
The 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 is false.

Exceptions

Type
Description
InvalidOperationException
Thrown by the built-in compiler when one or more code actions cannot be compiled.

Fields

public static List<string> DefaultUsings #
The base namespace imports considered when generated code-action source is created.

Remarks

A code-action definition can add imports through CodeActionDefinition.Usings or remove imports through CodeActionDefinition.ExcludedUsings.