# Class DeactivatedWorkflowActionProvider OptimaJet.Workflow.Core.Runtime.DeactivatedWorkflowActionProvider Wraps an [IWorkflowActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowActionProvider/) and allows it to be enabled or disabled dynamically. Namespace: [OptimaJet.Workflow.Core.Runtime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/) ```csharp public sealed class DeactivatedWorkflowActionProvider : IWorkflowActionProvider ``` ## Type Hierarchy - DeactivatedWorkflowActionProvider Current type - Implemented interfaces - [IWorkflowActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowActionProvider/) ## Constructors `public DeactivatedWorkflowActionProvider(IWorkflowActionProvider activatedActionProvider, Func getDisabled)` Initializes a new dynamically switchable wrapper around a workflow action provider. ### Parameters | Name | Type | Description | | --- | --- | --- | | `activatedActionProvider` | `IWorkflowActionProvider` | The provider to which calls are forwarded while `getDisabled` returns [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | | `getDisabled` | `Func` | The predicate evaluated for every method call. A result of [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) selects [EmptyWorkflowActionProvider.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/EmptyWorkflowActionProvider/); a result of [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) selects `activatedActionProvider`. | ## Methods `public void ExecuteAction(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)` Executes an action. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Name of the action to execute. | | `processInstance` | `ProcessInstance` | The process instance from which the action is executed. [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) | | `runtime` | `WorkflowRuntime` | The runtime instance that manages the process instance. [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) | | `actionParameter` | `String` | Additional action parameter value. [ActionDefinitionReference.ActionParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActionDefinitionReference/) | `public Task ExecuteActionAsync(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter, CancellationToken token)` Executes an action asynchronously. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Name of the action to execute. | | `processInstance` | `ProcessInstance` | The process instance from which the action is executed. [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) | | `runtime` | `WorkflowRuntime` | The runtime instance that manages the process instance. [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) | | `actionParameter` | `String` | Additional action parameter value. [ActionDefinitionReference.ActionParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActionDefinitionReference/) | | `token` | `CancellationToken` | Cancellation token. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public bool ExecuteCondition(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter)` Executes a condition and returns the result. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Name of the condition to check. | | `processInstance` | `ProcessInstance` | The process instance from which the condition is checked. [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) | | `runtime` | `WorkflowRuntime` | The runtime instance that manages the process instance. [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) | | `actionParameter` | `String` | Additional condition parameter value. [ActionDefinitionReference.ActionParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActionDefinitionReference/) | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the condition evaluates to true; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public Task ExecuteConditionAsync(string name, ProcessInstance processInstance, WorkflowRuntime runtime, string actionParameter, CancellationToken token)` Executes a condition asynchronously and returns the result. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Name of the condition to check. | | `processInstance` | `ProcessInstance` | The process instance from which the condition is checked. [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) | | `runtime` | `WorkflowRuntime` | The runtime instance that manages the process instance. [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) | | `actionParameter` | `String` | Additional condition parameter value. [ActionDefinitionReference.ActionParameter](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActionDefinitionReference/) | | `token` | `CancellationToken` | Cancellation token. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that resolves to [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the condition evaluates to true; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public bool IsActionAsync(string name, string schemeCode)` Checks whether an action should be executed asynchronously. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Name of the action. | | `schemeCode` | `String` | Code of the scheme that the action belongs to. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the action is asynchronous; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public bool IsConditionAsync(string name, string schemeCode)` Checks whether a condition should be evaluated asynchronously. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Name of the condition. | | `schemeCode` | `String` | Code of the scheme that the condition belongs to. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the condition is asynchronous; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public List GetActions(string schemeCode, NamesSearchType namesSearchType)` Returns action names for a scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | Code of the scheme for which action names are requested. | | `namesSearchType` | `NamesSearchType` | The name selection strategy. | ### Returns | Type | Description | | --- | --- | | `List` | A list of action names. | `public List GetConditions(string schemeCode, NamesSearchType namesSearchType)` Returns condition names for a scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | Code of the scheme for which condition names are requested. | | `namesSearchType` | `NamesSearchType` | The name selection strategy. | ### Returns | Type | Description | | --- | --- | | `List` | A list of condition names. | ## Remarks The wrapper evaluates the predicate supplied to the constructor on every method call. When the predicate returns [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool), the call is forwarded unchanged to the configured provider. When it returns [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool), the configured provider is bypassed and the call is delegated to [EmptyWorkflowActionProvider.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/EmptyWorkflowActionProvider/). Disabling the wrapper does not modify the configured provider. While disabled, the wrapper exposes no action or condition names, synchronous actions perform no work, synchronous conditions return [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool), and asynchronous capability checks return [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). Direct calls to the asynchronous execution methods are delegated to [EmptyWorkflowActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/EmptyWorkflowActionProvider/) and throw [NotImplementedException](https://learn.microsoft.com/dotnet/api/system.notimplementedexception). [Previous DeactivatedDesignerParameterFormatProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/DeactivatedDesignerParameterFormatProvider/) [Next DeactivatedWorkflowRuleProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/DeactivatedWorkflowRuleProvider/)