# Interface ICommandBuilder OptimaJet.Workflow.Core.Model.Builder.ICommandBuilder Provides fluent configuration for a [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/), including its [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/), [CommandDefinition.Comment](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/), and localized names. Namespace: [OptimaJet.Workflow.Core.Model.Builder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/) ```csharp public interface ICommandBuilder : IProcessDefinitionBuilder ``` ## Type Hierarchy - ICommandBuilder Current type - Base interfaces - [IProcessDefinitionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/IProcessDefinitionBuilder/) - Derived interfaces - [ICommandParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandParameterBuilder/) ## Methods `ICommandBuilder Ref(out CommandDefinition commandDefinition)` Provides access to the [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) currently being configured. ### Parameters | Name | Type | Description | | --- | --- | --- | | `commandDefinition` | `CommandDefinition` | When this method returns, contains the [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) currently being configured. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder Name(string name)` Sets the command name of the current [CommandDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The new command name. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandParameterBuilder CreateCommandParameter(string name, ParameterDefinition parameter)` Adds a command input that maps a value supplied under `name` to `parameter`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The name used to identify the command input when preparing the command for execution. | | `parameter` | `ParameterDefinition` | The [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/) of the process parameter that receives the submitted value. | ### Returns | Type | Description | | --- | --- | | `ICommandParameterBuilder` | An [ICommandParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandParameterBuilder/) for configuring the newly added command input. | ### Exceptions | Type | Description | | --- | --- | | `CommandParameterAlreadyExistsException` | A command input named `name` already exists in the current command. | `ICommandParameterBuilder CreateOrUpdateCommandParameter(string name, ParameterDefinition parameter)` Adds a command input named `name`, or updates the existing input with that name to map its submitted value to `parameter`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The name used to identify the command input when preparing the command for execution. | | `parameter` | `ParameterDefinition` | The [ParameterDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/) of the process parameter that receives the submitted value. | ### Returns | Type | Description | | --- | --- | | `ICommandParameterBuilder` | An [ICommandParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandParameterBuilder/) for configuring the added or updated command input. | ### Exceptions | Type | Description | | --- | --- | | `InvalidOperationException` | The existing input has a [ParameterDefinitionReference.DefaultValue](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionReference/) that cannot be deserialized as the [ParameterDefinition.Type](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinition/) of `parameter`. | `ICommandParameterBuilder UpdateCommandParameter(string name)` Selects the existing [ParameterDefinitionReference](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterDefinitionReference/) named `name` for further configuration. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The command input name. | ### Returns | Type | Description | | --- | --- | | `ICommandParameterBuilder` | An [ICommandParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandParameterBuilder/) for configuring the selected command input. | ### Exceptions | Type | Description | | --- | --- | | `CommandParameterNotFoundException` | The current command has no command input named `name`. | `ICommandBuilder DeleteCommandParameter(string name)` Removes the command input named `name` from [CommandDefinition.InputParameters](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/), if it exists. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The command input name. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder CreateCommentary(string comment)` Sets [CommandDefinition.Comment](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) for the current command, replacing any existing comment. ### Parameters | Name | Type | Description | | --- | --- | --- | | `comment` | `String` | The comment text. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder AppendCommentary(string comment)` Appends `comment` to [CommandDefinition.Comment](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/), inserting a line feed first when the current comment is not empty. ### Parameters | Name | Type | Description | | --- | --- | --- | | `comment` | `String` | The text to append. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder DeleteCommentary()` Clears [CommandDefinition.Comment](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/CommandDefinition/) for the current command. ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder CreateOrUpdateLocalization(CultureInfo culture, string value, bool isDefault = false)` Adds or updates a [Translation](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/Translation/) for the current command and `culture` using [LocalizeType.Command](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/LocalizeType/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `culture` | `CultureInfo` | The [CultureInfo](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo) for the localized command name. | | `value` | `String` | The localized command name. | | `isDefault` | `Boolean` | Whether to set [Translation.IsDefault](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/Translation/) so the translation can be used when no translation matches the requested culture. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder DeleteLocalization(CultureInfo culture)` Removes the [Translation](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/Translation/) for the current command and `culture`, if it exists. ### Parameters | Name | Type | Description | | --- | --- | --- | | `culture` | `CultureInfo` | The [CultureInfo](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo) of the translation to remove. | ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | `ICommandBuilder DeleteAllLocalizations()` Removes all [Translation](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/Translation/) entries for the current command that use [LocalizeType.Command](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/LocalizeType/). ### Returns | Type | Description | | --- | --- | | `ICommandBuilder` | The current instance of [ICommandBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandBuilder/). | [Previous ICodeActionBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICodeActionBuilder/) [Next ICommandParameterBuilder](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model.Builder/ICommandParameterBuilder/)