# Class WorkflowPluginWithRuleProvider OptimaJet.Workflow.Plugins.CustomWorkflowProviders.WorkflowPluginWithRuleProvider Namespace: [OptimaJet.Workflow.Plugins.CustomWorkflowProviders](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/) ```csharp public abstract class WorkflowPluginWithRuleProvider : WorkflowPlugin, ICustomMixProvider, ICustomWorkflowActionProvider, IWorkflowActionProvider, IDisableProvider, ICustomDesignerParameterFormatProvider, IDesignerParameterFormatProvider, ICustomActivityProvider, ICustomConditionProvider, IWorkflowPlugin, ICustomWorkflowRuleProvider, IWorkflowRuleProvider where EnumActions : struct where EnumActionsAsync : struct where EnumConditions : struct where EnumConditionsAsync : struct where EnumRules : struct where EnumRulesAsync : struct ``` ## Type Hierarchy - [WorkflowActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/WorkflowActionProvider-TEnumActions-TEnumActionsAsync-TEnumConditions-TEnumConditionsAsync/) - [WorkflowActionAndDesignerParameterFormatProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/WorkflowActionAndDesignerParameterFormatProvider-TEnumActions-TEnumActionsAsync-TEnumConditions-TEnumConditionsAsync/) - [CustomMixProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/CustomMixProvider-EnumActions-EnumActionsAsync-EnumConditions-EnumConditionsAsync/) - [WorkflowPlugin](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/WorkflowPlugin-TEnumActions-TEnumActionsAsync-TEnumConditions-TEnumConditionsAsync/) - WorkflowPluginWithRuleProvider Current type - [BasicPlugin](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins/BasicPlugin/) - Implemented interfaces - [ICustomMixProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/ICustomMixProvider/) - [ICustomActivityProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/ICustomActivityProvider/) - [ICustomConditionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/ICustomConditionProvider/) - [ICustomDesignerParameterFormatProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/ICustomDesignerParameterFormatProvider/) - [IDesignerParameterFormatProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IDesignerParameterFormatProvider/) - [ICustomWorkflowActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/ICustomWorkflowActionProvider/) - [IDisableProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/IDisableProvider/) - [IWorkflowActionProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowActionProvider/) - [ICustomWorkflowRuleProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/ICustomWorkflowRuleProvider/) - [IWorkflowRuleProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) - [IWorkflowPlugin](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins/IWorkflowPlugin/) ## Properties `protected Dictionary RulesExcludeRule { get; }` `protected Dictionary RulesAsyncExcludeRule { get; }` `protected Dictionary RulesCheck { get; }` `protected Dictionary RulesCheckAsync { get; }` `protected Dictionary RulesGetIdentities { get; }` `protected Dictionary RulesGetIdentitiesAsync { get; }` ## Methods `protected virtual List GetRules(NamesSearchType namesSearchType)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `namesSearchType` | `NamesSearchType` | | ### Returns | Type | Description | | --- | --- | | `List` | | `protected virtual List GetRulesAsync(NamesSearchType namesSearchType)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `namesSearchType` | `NamesSearchType` | | ### Returns | Type | Description | | --- | --- | | `List` | | `public virtual List GetRules(string schemeCode, NamesSearchType namesSearchType)` Gets the rule names implemented by this provider for a process scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The effective process scheme code used to resolve scheme-specific rules, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when the caller has no process scheme context. | | `namesSearchType` | `NamesSearchType` | The filtering mode. [NamesSearchType.All](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/NamesSearchType/) includes rules excluded by provider-specific exclusion settings and is used for runtime rule resolution. [NamesSearchType.NotExcluded](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/NamesSearchType/) omits those rules, for example when the Designer builds its list of available rules. | ### Returns | Type | Description | | --- | --- | | `List` | A non-null list of rule names implemented by this provider for the requested scheme and filtering mode. | `public virtual bool Check(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName, string parameter)` Determines whether a workflow participant identity satisfies a rule. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The process instance whose state and parameters provide the evaluation context. | | `runtime` | `WorkflowRuntime` | The workflow runtime executing the evaluation. | | `identityId` | `String` | The application-defined value identifying the workflow participant to evaluate, such as a login, user name, database identifier, or another identifier understood by the provider. | | `ruleName` | `String` | The name of a rule advertised by [IWorkflowRuleProvider.GetRules(string, NamesSearchType)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | | `parameter` | `String` | The provider-defined rule parameter. During standard restriction evaluation, this is the value from [ActorDefinition.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) after workflow substitutions have been applied. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if `identityId` belongs to the set defined by the rule; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Remarks The runtime calls this method when [IWorkflowRuleProvider.IsCheckAsync(string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) returns [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for the same rule and scheme. `public virtual Task CheckAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string identityId, string ruleName, string parameter, CancellationToken token)` Asynchronously determines whether a workflow participant identity satisfies a rule. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The process instance whose state and parameters provide the evaluation context. | | `runtime` | `WorkflowRuntime` | The workflow runtime executing the evaluation. | | `identityId` | `String` | The application-defined value identifying the workflow participant to evaluate, such as a login, user name, database identifier, or another identifier understood by the provider. | | `ruleName` | `String` | The name of a rule advertised by [IWorkflowRuleProvider.GetRules(string, NamesSearchType)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | | `parameter` | `String` | The provider-defined rule parameter. During standard restriction evaluation, this is the value from [ActorDefinition.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) after workflow substitutions have been applied. | | `token` | `CancellationToken` | The token supplied by the current workflow operation to observe cancellation. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if `identityId` belongs to the set defined by the rule; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | ### Remarks The runtime calls this method when [IWorkflowRuleProvider.IsCheckAsync(string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) returns [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for the same rule and scheme. `public virtual IEnumerable GetIdentities(ProcessInstance processInstance, WorkflowRuntime runtime, string ruleName, string parameter)` Gets all workflow participant identities that satisfy a rule. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The process instance whose state and parameters provide the lookup context. | | `runtime` | `WorkflowRuntime` | The workflow runtime executing the lookup. | | `ruleName` | `String` | The name of a rule advertised by [IWorkflowRuleProvider.GetRules(string, NamesSearchType)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | | `parameter` | `String` | The provider-defined rule parameter. During standard actor calculation, this is the value from [ActorDefinition.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) after workflow substitutions have been applied. | ### Returns | Type | Description | | --- | --- | | `IEnumerable` | A non-null sequence of application-defined workflow participant identities. Each value must use the same identity representation accepted by [IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | ### Remarks The runtime calls this method when [IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) returns [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for the same rule and scheme. `public virtual Task> GetIdentitiesAsync(ProcessInstance processInstance, WorkflowRuntime runtime, string ruleName, string parameter, CancellationToken token)` Asynchronously gets all workflow participant identities that satisfy a rule. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The process instance whose state and parameters provide the lookup context. | | `runtime` | `WorkflowRuntime` | The workflow runtime executing the lookup. | | `ruleName` | `String` | The name of a rule advertised by [IWorkflowRuleProvider.GetRules(string, NamesSearchType)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | | `parameter` | `String` | The provider-defined rule parameter. During standard actor calculation, this is the value from [ActorDefinition.Value](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActorDefinition/) after workflow substitutions have been applied. | | `token` | `CancellationToken` | The token supplied by the current workflow operation to observe cancellation. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is a non-null sequence of application-defined workflow participant identities. Each value must use the same identity representation accepted by [IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | ### Remarks The runtime calls this method when [IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) returns [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) for the same rule and scheme. `public virtual bool IsCheckAsync(string ruleName, string schemeCode)` Indicates whether the runtime should call [IWorkflowRuleProvider.CheckAsync(ProcessInstance, WorkflowRuntime, string, string, string, CancellationToken)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) instead of [IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) for a rule. ### Parameters | Name | Type | Description | | --- | --- | --- | | `ruleName` | `String` | The name of a rule advertised by [IWorkflowRuleProvider.GetRules(string, NamesSearchType)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | | `schemeCode` | `String` | The effective process scheme code used to resolve the rule. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to use [IWorkflowRuleProvider.CheckAsync(ProcessInstance, WorkflowRuntime, string, string, string, CancellationToken)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/); [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to use [IWorkflowRuleProvider.Check(ProcessInstance, WorkflowRuntime, string, string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | ### Remarks This choice is independent of the identity lookup mode returned by [IWorkflowRuleProvider.IsGetIdentitiesAsync(string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). `public virtual bool IsGetIdentitiesAsync(string ruleName, string schemeCode)` Indicates whether the runtime should call [IWorkflowRuleProvider.GetIdentitiesAsync(ProcessInstance, WorkflowRuntime, string, string, CancellationToken)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) instead of [IWorkflowRuleProvider.GetIdentities(ProcessInstance, WorkflowRuntime, string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) for a rule. ### Parameters | Name | Type | Description | | --- | --- | --- | | `ruleName` | `String` | The name of a rule advertised by [IWorkflowRuleProvider.GetRules(string, NamesSearchType)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | | `schemeCode` | `String` | The effective process scheme code used to resolve the rule. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to use [IWorkflowRuleProvider.GetIdentitiesAsync(ProcessInstance, WorkflowRuntime, string, string, CancellationToken)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/); [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to use [IWorkflowRuleProvider.GetIdentities(ProcessInstance, WorkflowRuntime, string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). | ### Remarks This choice is independent of the rule-checking mode returned by [IWorkflowRuleProvider.IsCheckAsync(string, string)](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/). `public void ExcludeRule(string ruleName, ExcludeRule excludeRule = null)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `ruleName` | `String` | | | `excludeRule` | `ExcludeRule` | | `public bool ValidateRules(out List rules, bool withExceptions = false)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `rules` | `List` | | | `withExceptions` | `Boolean` | | ### Returns | Type | Description | | --- | --- | | `Boolean` | | `public bool ValidateRulesAsync(out List rulesAsync, bool withExceptions = false)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `rulesAsync` | `List` | | | `withExceptions` | `Boolean` | | ### Returns | Type | Description | | --- | --- | | `Boolean` | | `public void OverrideRuleProvider(IWorkflowRuleProvider workflowRuleProvider)` Sets a custom workflow rule provider for the plugin, replacing the default implementation for resolving rules. ### Parameters | Name | Type | Description | | --- | --- | --- | | `workflowRuleProvider` | `IWorkflowRuleProvider` | The [IWorkflowRuleProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/IWorkflowRuleProvider/) implementation to use for resolving workflow rules. | [Previous WorkflowPlugin](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.CustomWorkflowProviders/WorkflowPlugin-TEnumActions-TEnumActionsAsync-TEnumConditions-TEnumConditionsAsync/) [Next ActionsAsyncLoopPlugin](https://api.workflowengine.io/core/OptimaJet.Workflow.Plugins.LoopsPlugin/ActionsAsyncLoopPlugin/)