# Class SqliteProvider OptimaJet.Workflow.SQLite.SqliteProvider SQLite-based implementation of IWorkflowProvider and IMigratable that provides persistence for workflow processes, schemes, timers, approval history, and forms. Namespace: [OptimaJet.Workflow.SQLite](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/) ```csharp public class SqliteProvider : IWorkflowProvider, IPersistenceProvider, IApprovalProvider, IFormDataProvider, ISchemePersistenceProvider, IWorkflowGenerator, IMigratable ``` ## Type Hierarchy - SqliteProvider Current type - [FileSchemePersistenceSqliteProvider](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/FileSchemePersistenceSqliteProvider/) - Implemented interfaces - [IMigratable](https://api.workflowengine.io/migrator/OptimaJet.Workflow.Migrator/IMigratable/) - [IWorkflowProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IWorkflowProvider/) - [IPersistenceProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IPersistenceProvider/) - [IApprovalProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IApprovalProvider/) - [IFormDataProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IFormDataProvider/) - [ISchemePersistenceProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ISchemePersistenceProvider-TSchemeMedium/) - [IWorkflowGenerator](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Generator/IWorkflowGenerator-TSchemeMedium/) ## Constructors `public SqliteProvider(string connectionString, string schemaName = "main", bool writeToHistory = true, bool writeSubProcessToRoot = false)` Initializes a new instance of [SqliteProvider](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/SqliteProvider/) with the specified connection string. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connectionString` | `String` | The SQLite connection string. | | `schemaName` | `String` | The database schema name. | | `writeToHistory` | `Boolean` | Whether to write transition history. | | `writeSubProcessToRoot` | `Boolean` | Whether to write subprocess data to the root process. | `public SqliteProvider(PersistenceProviderOptions options)` Initializes a new instance of [SqliteProvider](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/SqliteProvider/) with the specified options. ### Parameters | Name | Type | Description | | --- | --- | --- | | `options` | `PersistenceProviderOptions` | The persistence provider options. | ## Properties `public string Id { get; }` Gets the identifier of the persistence provider implementation. `public string ConnectionString { get; }` Gets the connection string configured for the persistence provider. `public WorkflowProcessInstance WorkflowProcessInstance { get; }` Gets the database object for workflow process instances. `public WorkflowProcessInstanceStatus WorkflowProcessInstanceStatus { get; }` Gets the database object for workflow process instance statuses. `public WorkflowProcessInstancePersistence WorkflowProcessInstancePersistence { get; }` Gets the database object for workflow process instance persistence parameters. `public WorkflowProcessTransitionHistory WorkflowProcessTransitionHistory { get; }` Gets the database object for workflow process transition history. `public WorkflowProcessTimer WorkflowProcessTimer { get; }` Gets the database object for workflow process timers. `public WorkflowInbox WorkflowInbox { get; }` Gets the database object for workflow inbox items. `public WorkflowApprovalHistory WorkflowApprovalHistory { get; }` Gets the database object for workflow approval history. `public WorkflowGlobalParameter WorkflowGlobalParameter { get; }` Gets the database object for workflow global parameters. `public WorkflowProcessScheme WorkflowProcessScheme { get; }` Gets the database object for workflow process schemes. `public WorkflowRuntime WorkflowRuntime { get; }` Gets the database object for workflow runtimes. `public WorkflowScheme WorkflowScheme { get; }` Gets the database object for workflow schemes. `public WorkflowSync WorkflowSync { get; }` Gets the database object for workflow synchronization locks. `public ProcessInstanceTree ProcessInstanceTree { get; }` Gets the database object for process instance tree items. `public WorkflowForm WorkflowForm { get; }` Gets the database object for workflow forms. `public bool IsBulkOperationsSupported { get; }` Gets a value indicating whether the provider supports bulk process initialization. ## Methods `public virtual void Init(WorkflowRuntime runtime)` Initializes the persistence provider for a WorkflowRuntime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtime` | `WorkflowRuntime` | The WorkflowRuntime that uses this provider. | `public virtual Task DeleteInactiveTimersByProcessIdAsync(Guid processId)` Deletes timer registrations for a ProcessInstance that have been marked as ignored. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task DeleteTimerAsync(Guid timerId)` Deletes a persisted timer registration. ### Parameters | Name | Type | Description | | --- | --- | --- | | `timerId` | `Guid` | The timer registration identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task> GetRunningProcessesAsync(string runtimeId = null)` Gets the identifiers of ProcessInstance objects whose status is ProcessStatus.Running. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeId` | `String` | The optional runtime identifier used to filter the ProcessInstance objects, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or an empty string to include all WorkflowRuntime instances. | ### Returns | Type | Description | | --- | --- | | `Task` | The identifiers of the matching ProcessInstance objects. | `public virtual Task CreateWorkflowRuntimeAsync(string runtimeId, RuntimeStatus status)` Creates a persisted operational record for a WorkflowRuntime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeId` | `String` | The runtime identifier. | | `status` | `RuntimeStatus` | The initial RuntimeStatus. | ### Returns | Type | Description | | --- | --- | | `Task` | The created WorkflowRuntimeModel. | `public virtual Task DeleteWorkflowRuntimeAsync(string name)` Deletes a persisted WorkflowRuntime record. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The runtime identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task DropUnusedWorkflowProcessSchemeAsync()` Deletes obsolete compiled process schemes that are not referenced by persisted ProcessInstance records when the provider supports this cleanup operation. ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `NotImplementedException` | The provider does not support cleanup of unused compiled process schemes. | `public Task> GetProcessInstancesAsync(List<(string parameterName, SortDirection sortDirection)> orderParameters = null, Paging paging = null)` Gets persisted process instance records using optional ordering and paging. ### Parameters | Name | Type | Description | | --- | --- | --- | | `orderParameters` | `List` | The ordered list of persisted field names and corresponding SortDirection values, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to use the provider's default ordering. | | `paging` | `Paging` | The optional Paging settings. | ### Returns | Type | Description | | --- | --- | | `Task` | The selected ProcessInstanceItem records. | `public Task GetProcessInstancesCountAsync()` Gets the total number of persisted process instance records. ### Returns | Type | Description | | --- | --- | | `Task` | The number of persisted process instance records. | `public Task> GetSchemesAsync(List<(string parameterName, SortDirection sortDirection)> orderParameters = null, Paging paging = null)` Gets persisted workflow scheme records using the specified ordering and paging. ### Parameters | Name | Type | Description | | --- | --- | --- | | `orderParameters` | `List` | The ordered list of persisted field names and corresponding SortDirection values. | | `paging` | `Paging` | The Paging settings. | ### Returns | Type | Description | | --- | --- | | `Task` | The selected SchemeItem records. | `public Task GetSchemesCountAsync()` Gets the total number of persisted workflow scheme records. ### Returns | Type | Description | | --- | --- | | `Task` | The number of persisted workflow scheme records. | `public virtual Task UpdateWorkflowRuntimeStatusAsync(WorkflowRuntimeModel runtime, RuntimeStatus status)` Updates the persisted status of a WorkflowRuntime using its concurrency token. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtime` | `WorkflowRuntimeModel` | The WorkflowRuntimeModel containing the current WorkflowRuntimeModel.Lock. | | `status` | `RuntimeStatus` | The new RuntimeStatus. | ### Returns | Type | Description | | --- | --- | | `Task` | The updated WorkflowRuntimeModel. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetRuntimeStatusException` | The WorkflowRuntimeModel cannot be updated with the supplied concurrency token. | `public virtual Task<(bool Success, WorkflowRuntimeModel UpdatedModel)> UpdateWorkflowRuntimeRestorerAsync(WorkflowRuntimeModel runtime, string restorerId)` Attempts to assign a WorkflowRuntime to restore processes associated with another WorkflowRuntime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtime` | `WorkflowRuntimeModel` | The WorkflowRuntimeModel containing the current WorkflowRuntimeModel.Lock. | | `restorerId` | `String` | The runtime identifier to store in WorkflowRuntimeModel.RestorerId. | ### Returns | Type | Description | | --- | --- | | `Task` | A result that indicates whether the update succeeded and contains the updated WorkflowRuntimeModel when it did. | `public virtual Task MultiServerRuntimesExistAsync()` Determines whether persistence contains a multi-server WorkflowRuntime record whose status is neither RuntimeStatus.Dead nor RuntimeStatus.Terminated. ### Returns | Type | Description | | --- | --- | | `Task` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when such a WorkflowRuntime record exists; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public virtual Task ActiveMultiServerRuntimesCountAsync(string currentRuntimeId)` Counts multi-server WorkflowRuntime records whose status is RuntimeStatus.Alive, RuntimeStatus.Restore, or RuntimeStatus.SelfRestore, excluding the specified runtime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `currentRuntimeId` | `String` | The runtime identifier to exclude from the count. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of other active multi-server WorkflowRuntime records. | `public virtual Task InitializeProcessAsync(ProcessInstance processInstance)` Creates the persisted process instance record for a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance to persist. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ProcessAlreadyExistsException` | A persisted record already exists with the ProcessInstance.ProcessId of `processInstance`. | `public virtual Task BindProcessToNewSchemeAsync(ProcessInstance processInstance)` Updates a persisted ProcessInstance to reference its new process scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose ProcessInstance.ProcessScheme has changed. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ProcessNotFoundException` | No persisted record exists with the ProcessInstance.ProcessId of `processInstance`. | `public virtual Task FillProcessParametersAsync(ProcessInstance processInstance)` Loads ParameterPurpose.System and ParameterPurpose.Persistence process parameters into a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance to populate. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task FillPersistedProcessParametersAsync(ProcessInstance processInstance)` Loads all ParameterPurpose.Persistence process parameters into a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance to populate. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task FillPersistedProcessParameterAsync(ProcessInstance processInstance, string parameterName)` Loads one ParameterPurpose.Persistence process parameter into a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance to populate. | | `parameterName` | `String` | The parameter name. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task FillSystemProcessParametersAsync(ProcessInstance processInstance)` Loads ParameterPurpose.System process parameters into a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance to populate. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task SavePersistenceParametersAsync(ProcessInstance processInstance)` Saves changed process parameters whose purpose is ParameterPurpose.Persistence. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose parameters are saved. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `processInstance` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | `public virtual Task SavePersistenceParameterAsync(ProcessInstance processInstance, string parameterName)` Saves one modified process parameter whose purpose is ParameterPurpose.Persistence. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose parameter is saved. | | `parameterName` | `String` | The parameter name. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentNullException` | `processInstance` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null). | | `ArgumentException` | `parameterName` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or empty. | | `InvalidOperationException` | No modified ParameterPurpose.Persistence parameter named `parameterName` is available to save. | `public virtual Task RemoveParameterAsync(ProcessInstance processInstance, string parameterName)` Deletes the persisted value of a named process parameter. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose parameter value is deleted. | | `parameterName` | `String` | The parameter name. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task SetProcessStatusAsync(Guid processId, ProcessStatus newStatus)` Sets the ProcessStatus of a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | | `newStatus` | `ProcessStatus` | The ProcessStatus to persist. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetStatusException` | The ProcessStatus cannot be changed. | `public virtual Task SetWorkflowInitializedAsync(ProcessInstance processInstance)` Sets the process instance status to ProcessStatus.Initialized. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose status is set. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetStatusException` | The ProcessStatus cannot be changed. | `public virtual Task SetWorkflowIdledAsync(ProcessInstance processInstance)` Sets the process instance status to ProcessStatus.Idled. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose status is set. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetStatusException` | The ProcessStatus cannot be changed. | `public virtual Task SetWorkflowRunningAsync(ProcessInstance processInstance)` Sets the process instance status to ProcessStatus.Running. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose status is set. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetStatusException` | The ProcessStatus cannot be changed. | `public virtual Task SetWorkflowFinalizedAsync(ProcessInstance processInstance)` Sets the process instance status to ProcessStatus.Finalized. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose status is set. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetStatusException` | The ProcessStatus cannot be changed. | `public virtual Task SetWorkflowTerminatedAsync(ProcessInstance processInstance)` Sets the process instance status to ProcessStatus.Terminated. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose status is set. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetStatusException` | The ProcessStatus cannot be changed. | `public Task WriteInitialRecordToHistoryAsync(ProcessInstance processInstance)` Writes the initial transition history record for the current activity when transition history persistence is enabled. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance whose initial record is written. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task UpdatePersistenceStateAsync(ProcessInstance processInstance, TransitionDefinition transition)` Updates persisted process activity, state, and transition history for an executed transition according to the destination activity's persistence settings. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The ProcessInstance that completed the transition. | | `transition` | `TransitionDefinition` | The executed TransitionDefinition. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Remarks State and transition history persistence are controlled independently by ActivityDefinition.DisablePersistState and ActivityDefinition.DisablePersistTransitionHistory. `public virtual Task IsProcessExistsAsync(Guid processId)` Determines whether a ProcessInstance exists in persistence. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the ProcessInstance exists; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public virtual Task IsProcessExistsAsync(Guid processId, string tenantId)` Determines whether a ProcessInstance exists in persistence for a tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | | `tenantId` | `String` | The tenant identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the ProcessInstance exists for the tenant; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `public virtual Task GetInstanceStatusAsync(Guid processId)` Gets the ProcessStatus of a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The persisted ProcessStatus, ProcessStatus.NotFound when the process has no status record, or ProcessStatus.Unknown when the persisted status is not recognized. | `public virtual Task DeleteProcessAsync(Guid[] processIds)` Deletes persisted process instance records and related records managed by the provider. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processIds` | `Guid[]` | The process identifiers. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task DeleteProcessAsync(Guid processId)` Deletes the persisted process instance record and related records managed by the provider. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task RegisterTimerAsync(Guid processId, Guid rootProcessId, string name, DateTime nextExecutionDateTime, string tenantId, bool notOverrideIfExists)` Creates or updates a persisted timer registration for a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the ProcessInstance that owns the timer. | | `rootProcessId` | `Guid` | The identifier of the root process in the owning process tree. | | `name` | `String` | The timer name. | | `nextExecutionDateTime` | `DateTime` | The date and time when the timer becomes due. | | `tenantId` | `String` | The tenant identifier, if any. | | `notOverrideIfExists` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to retain an existing registration with the same process identifier and timer name; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to update its execution time. This value corresponds to TimerDefinition.NotOverrideIfExists. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task ClearTimersAsync(Guid processId, List timersIgnoreList)` Deletes all persisted timer registrations for a ProcessInstance except timers whose names are retained. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | | `timersIgnoreList` | `List` | The timer names to retain. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task SetTimerIgnoreAsync(Guid timerId)` Marks a persisted timer registration as ignored so it is not selected for execution. ### Parameters | Name | Type | Description | | --- | --- | --- | | `timerId` | `Guid` | | ### Returns | Type | Description | | --- | --- | | `Task` | The number of timer records changed. | `public virtual Task> GetTopTimersToExecuteAsync(int top)` Gets a limited set of due timer registrations that have not been marked as ignored. ### Parameters | Name | Type | Description | | --- | --- | --- | | `top` | `Int32` | The maximum number of timer registrations to return. | ### Returns | Type | Description | | --- | --- | | `Task` | The due WorkflowTimer objects in execution-time order. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentException` | `top` is not greater than zero. | `public virtual Task SaveGlobalParameterAsync(string type, string name, T value)` Saves a global parameter value that is not scoped to a tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `name` | `String` | The parameter name. | | `value` | `{T}` | The parameter value. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task SaveTenantGlobalParameterAsync(TenantGlobalParameterKey key, T value)` Saves a global parameter value in the tenant scope specified by a TenantGlobalParameterKey. ### Parameters | Name | Type | Description | | --- | --- | --- | | `key` | `TenantGlobalParameterKey` | The TenantGlobalParameterKey. Its TenantGlobalParameterKey.Name is required. | | `value` | `{T}` | The parameter value. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task LoadGlobalParameterAsync(string type, string name)` Loads a global parameter value that is not scoped to a tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `name` | `String` | The parameter name. | ### Returns | Type | Description | | --- | --- | | `Task` | The parameter value, or the [default](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/default) value of `T` when no matching parameter exists. | `public virtual Task LoadTenantGlobalParameterAsync(TenantGlobalParameterKey key)` Loads a global parameter value from the tenant scope specified by a TenantGlobalParameterKey. ### Parameters | Name | Type | Description | | --- | --- | --- | | `key` | `TenantGlobalParameterKey` | The TenantGlobalParameterKey. Its TenantGlobalParameterKey.Name is required. | ### Returns | Type | Description | | --- | --- | | `Task` | The parameter value, or the [default](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/default) value of `T` when no matching parameter exists. | `public Task> LoadGlobalParametersWithNamesAsync(string type, Sorting sort = null)` Loads the names and values of global parameters that have a logical type and are not scoped to a tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `sort` | `Sorting` | The optional Sorting settings. | ### Returns | Type | Description | | --- | --- | | `Task` | A mapping from parameter names to values. | `public Task> LoadTenantGlobalParametersWithNamesAsync(TenantGlobalParameterScope scope, Sorting sort = null)` Loads global parameter names and values from a TenantGlobalParameterScope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The TenantGlobalParameterScope to load. | | `sort` | `Sorting` | The optional Sorting settings. | ### Returns | Type | Description | | --- | --- | | `Task` | A mapping from parameter names to values. | `public virtual Task> LoadGlobalParametersAsync(string type, Sorting sort = null)` Loads the values of global parameters that have a logical type and are not scoped to a tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `sort` | `Sorting` | The optional Sorting settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | The parameter values. | `public virtual Task> LoadTenantGlobalParametersAsync(TenantGlobalParameterScope scope, Sorting sort = null)` Loads global parameter values from a TenantGlobalParameterScope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The TenantGlobalParameterScope to load. | | `sort` | `Sorting` | The optional Sorting settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | The parameter values. | `public virtual Task> LoadGlobalParametersWithPagingAsync(string type, Paging paging, string name = null, Sorting sort = null)` Loads a page of global parameter values and the total matching count. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `paging` | `Paging` | The Paging settings. | | `name` | `String` | The optional parameter-name filter. | | `sort` | `Sorting` | The optional Sorting settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | A PagedResponse containing the selected parameter values and total matching count. | `public virtual Task> LoadTenantGlobalParametersWithPagingAsync(TenantGlobalParameterScope scope, Paging paging, Sorting sort = null)` Loads a page of global parameter values from a TenantGlobalParameterScope and the total matching count. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The TenantGlobalParameterScope to load. | | `paging` | `Paging` | The Paging settings. | | `sort` | `Sorting` | The optional Sorting settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | A PagedResponse containing the selected parameter values and total matching count. | `public virtual Task DeleteGlobalParametersAsync(string type, string name = null)` Deletes global parameters that are not scoped to a tenant, optionally limiting the deletion by name. ### Parameters | Name | Type | Description | | --- | --- | --- | | `type` | `String` | The logical parameter type. | | `name` | `String` | The parameter name to delete, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to delete every parameter of the logical type. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task DeleteTenantGlobalParametersAsync(TenantGlobalParameterScope scope)` Deletes all global parameters in a TenantGlobalParameterScope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The TenantGlobalParameterScope to delete. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task DeleteTenantGlobalParameterAsync(TenantGlobalParameterKey key)` Deletes one global parameter identified by a TenantGlobalParameterKey. ### Parameters | Name | Type | Description | | --- | --- | --- | | `key` | `TenantGlobalParameterKey` | The TenantGlobalParameterKey to delete. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task> GetProcessHistoryAsync(Guid processId, Paging paging = null)` Gets persisted transition history for a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | | `paging` | `Paging` | The optional Paging settings. | ### Returns | Type | Description | | --- | --- | | `Task` | The persisted ProcessHistoryItem records. | `public Task GetProcessHistoryCountAsync(Guid processId)` Gets the number of persisted transition history records for a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of persisted transition history records. | `public virtual Task> GetTimersForProcessAsync(Guid processId)` Gets all persisted timer registrations for a ProcessInstance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The ProcessTimer objects registered for the ProcessInstance. | `public virtual Task> GetProcessInstanceTreeAsync(Guid rootProcessId)` Gets the persisted process instance tree for a root process. ### Parameters | Name | Type | Description | | --- | --- | --- | | `rootProcessId` | `Guid` | The root process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The IProcessInstanceTreeItem records in the process instance tree. | `public virtual Task> GetActiveTimersForProcessAsync(Guid processId)` Gets the timer registrations for a ProcessInstance that have not been marked as ignored. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The active ProcessTimer objects registered for the ProcessInstance. | `public virtual Task GetWorkflowRuntimeModelAsync(string runtimeId)` Gets the persisted operational model for a WorkflowRuntime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeId` | `String` | The runtime identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The persisted WorkflowRuntimeModel, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when no matching runtime record exists. | `public virtual Task SendRuntimeLastAliveSignalAsync()` Updates WorkflowRuntimeModel.LastAliveSignal for the current WorkflowRuntime when its status is RuntimeStatus.Alive or RuntimeStatus.SelfRestore. ### Returns | Type | Description | | --- | --- | | `Task` | The number of runtime records changed. | `public virtual Task GetNextTimerDateAsync(TimerCategory timerCategory, int timerInterval)` Attempts to reserve the next timer polling time for a TimerCategory in multi-server mode. ### Parameters | Name | Type | Description | | --- | --- | --- | | `timerCategory` | `TimerCategory` | The TimerCategory.Timer or TimerCategory.ServiceTimer category whose polling time is reserved. | | `timerInterval` | `Int32` | The interval, in milliseconds, between polling times. | ### Returns | Type | Description | | --- | --- | | `Task` | The reserved polling date and time, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when another WorkflowRuntime changed the coordination lock first. | `public virtual Task> GetWorkflowRuntimesAsync()` Gets all persisted WorkflowRuntimeModel records. ### Returns | Type | Description | | --- | --- | | `Task` | The persisted WorkflowRuntimeModel objects. | `public void ConfigureMigrations(IMigrationRunnerBuilder builder, Assembly assembly)` Configures FluentMigrator to run the migration from the provided assembly. ### Parameters | Name | Type | Description | | --- | --- | --- | | `builder` | `IMigrationRunnerBuilder` | The instance of the interface for configuring migration runner services. | | `assembly` | `Assembly` | The assembly with migrations. | `public virtual Task> GetProcessSchemeByProcessIdAsync(Guid processId)` Gets the stored built scheme version assigned to a process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose assigned scheme is retrieved. | ### Returns | Type | Description | | --- | --- | | `Task` | The SchemeDefinition assigned to the process instance. | ### Exceptions | Type | Description | | --- | --- | | `ProcessNotFoundException` | Thrown when no process instance exists with `processId`. | | `SchemeNotFoundException` | Thrown when the process instance has no assigned scheme or its stored built scheme version cannot be found. | `public virtual Task> GetProcessSchemeBySchemeIdAsync(Guid schemeId)` Gets a stored built scheme version by its scheme ID. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeId` | `Guid` | The scheme ID of the stored built scheme version. | ### Returns | Type | Description | | --- | --- | | `Task` | The requested SchemeDefinition. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no stored built scheme version exists with `schemeId`. | `public virtual Task> GetProcessSchemeWithParametersAsync(string schemeCode, Guid? rootSchemeId, bool ignoreObsolete, string tenantId = null)` Gets a stored built scheme version that matches a scheme code, root scheme ID, obsolete-version filter, and tenant scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the stored built scheme version to retrieve. | | `rootSchemeId` | `Nullable` | The root scheme ID for a subprocess scheme, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to select versions without a root scheme. | | `ignoreObsolete` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to exclude obsolete versions; [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) to include obsolete and non-obsolete versions. | | `tenantId` | `String` | The tenant identifier that defines the exact search scope, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to search shared schemes. | ### Returns | Type | Description | | --- | --- | | `Task` | The matching SchemeDefinition. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no stored built scheme version matches the supplied criteria. | `public virtual Task SetSchemeIsObsoleteAsync(string schemeCode, string tenantId = null)` Marks stored built scheme versions associated with a scheme code as obsolete. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The scheme code whose stored built versions are marked obsolete. | | `tenantId` | `String` | The tenant identifier to target, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to target matching versions in every tenant scope. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task> SaveSchemeAsync(SchemeDefinition scheme)` Stores a built scheme version if no matching version is already persisted. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scheme` | `SchemeDefinition` | The SchemeDefinition containing the built scheme and stored-version metadata to persist. | ### Returns | Type | Description | | --- | --- | | `Task` | The stored SchemeDefinition, either newly inserted or an existing matching version. | `public virtual Task UpsertSchemeAsync(SchemeDefinition scheme)` Inserts or updates a stored built scheme version. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scheme` | `SchemeDefinition` | The SchemeDefinition containing the built scheme and stored-version metadata to insert or update. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task SaveSchemeAsync(string schemaCode, bool canBeInlined, List inlinedSchemes, string scheme, List tags, string tenantId = null)` Saves an unparsed source scheme together with its Scheme Inlining relationships and tags. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemaCode` | `String` | | | `canBeInlined` | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the scheme can be inlined into another scheme; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | | `inlinedSchemes` | `List` | The codes of the inlinable schemes referenced by this scheme. | | `scheme` | `String` | The serialized unparsed source scheme. | | `tags` | `List` | The scheme tags to store. | | `tenantId` | `String` | The tenant identifier that defines the exact storage scope, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for a shared scheme. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public virtual Task GetSchemeAsync(string code, string tenantId = null)` Gets the unparsed source scheme identified by a scheme code. ### Parameters | Name | Type | Description | | --- | --- | --- | | `code` | `String` | The code of the source scheme to retrieve. | | `tenantId` | `String` | The tenant identifier used to prefer a tenant-specific scheme over a shared scheme, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to search only shared schemes. | ### Returns | Type | Description | | --- | --- | | `Task` | The unparsed source scheme represented by [XElement](https://learn.microsoft.com/dotnet/api/system.xml.linq.xelement). | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `code` is available in the requested scope. | `public virtual Task> GetInlinedSchemeCodesAsync(string tenantId = null)` Gets the distinct codes of schemes available for use as inlinable schemes. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tenantId` | `String` | The tenant identifier. When specified, the result includes shared schemes and schemes in that tenant scope; when [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), the result includes only shared schemes. | ### Returns | Type | Description | | --- | --- | | `Task` | The distinct inlinable scheme codes. | `public virtual Task> GetRelatedByInliningSchemeCodesAsync(string schemeCode, string tenantId = null)` Gets the distinct codes of schemes that inline the specified scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the inlinable scheme. | | `tenantId` | `String` | The tenant identifier of the parent schemes to search. When specified, only that tenant scope is searched; when [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null), shared schemes and all tenant scopes are searched. | ### Returns | Type | Description | | --- | --- | | `Task` | The distinct codes of schemes that inline the specified scheme. | `public virtual Task> SearchSchemesByTagsAsync(params string[] tags)` Gets the codes of shared schemes that match at least one specified tag. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tags` | `String[]` | The tags to match. If the array is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or empty, all shared scheme codes are returned. | ### Returns | Type | Description | | --- | --- | | `Task` | The matching shared scheme codes. | `public virtual Task> SearchSchemesByTagsAsync(IEnumerable tags)` Gets the codes of shared schemes that match at least one specified tag. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tags` | `IEnumerable` | The tags to match, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to return all shared scheme codes. An empty collection also returns all shared scheme codes. | ### Returns | Type | Description | | --- | --- | | `Task` | The matching shared scheme codes. | `public virtual Task> SearchSchemesByTagsAsync(string tenantId, IEnumerable tags)` Gets the codes of schemes in an exact tenant scope that match at least one specified tag. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tenantId` | `String` | The tenant identifier that defines the exact search scope, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to search shared schemes. | | `tags` | `IEnumerable` | The tags to match, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to return every scheme code in the selected scope. An empty collection also returns every scheme code in that scope. | ### Returns | Type | Description | | --- | --- | | `Task` | The matching scheme codes in the selected scope. | `public virtual Task> SearchSchemesByTagsInTenantAsync(string tenantId, params string[] tags)` Gets the codes of schemes in a specified tenant that match at least one specified tag. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tenantId` | `String` | The tenant identifier that defines the exact search scope. | | `tags` | `String[]` | The tags to match. If the array is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or empty, every scheme code in the tenant scope is returned. | ### Returns | Type | Description | | --- | --- | | `Task` | The matching scheme codes in the specified tenant. | `public virtual Task AddSchemeTagsAsync(string schemeCode, params string[] tags)` Adds tags to a source scheme in the shared scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the shared source scheme. | | `tags` | `String[]` | The scheme tags to add. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when the shared source scheme identified by `schemeCode` does not exist. | `public virtual Task AddSchemeTagsAsync(string schemeCode, IEnumerable tags)` Adds tags to a source scheme in the shared scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the shared source scheme. | | `tags` | `IEnumerable` | The scheme tags to add. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when the shared source scheme identified by `schemeCode` does not exist. | `public virtual Task AddSchemeTagsAsync(string schemeCode, string tenantId, IEnumerable tags)` Adds tags to a source scheme in an exact tenant scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The source scheme code. | | `tenantId` | `String` | The tenant identifier that defines the exact scope, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for the shared scope. | | `tags` | `IEnumerable` | The scheme tags to add. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `schemeCode` exists in the scope selected by `tenantId`. | `public virtual Task AddSchemeTagsInTenantAsync(string schemeCode, string tenantId, params string[] tags)` Adds tags to a source scheme in a specified tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The source scheme code. | | `tenantId` | `String` | The tenant identifier that defines the exact scope. | | `tags` | `String[]` | The scheme tags to add. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `schemeCode` exists in the scope selected by `tenantId`. | `public virtual Task RemoveSchemeTagsAsync(string schemeCode, params string[] tags)` Removes tags from a source scheme in the shared scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the shared source scheme. | | `tags` | `String[]` | The scheme tags to remove. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when the shared source scheme identified by `schemeCode` does not exist. | `public virtual Task RemoveSchemeTagsAsync(string schemeCode, IEnumerable tags)` Removes tags from a source scheme in the shared scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the shared source scheme. | | `tags` | `IEnumerable` | The scheme tags to remove. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when the shared source scheme identified by `schemeCode` does not exist. | `public virtual Task RemoveSchemeTagsAsync(string schemeCode, string tenantId, IEnumerable tags)` Removes tags from a source scheme in an exact tenant scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The source scheme code. | | `tenantId` | `String` | The tenant identifier that defines the exact scope, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for the shared scope. | | `tags` | `IEnumerable` | The scheme tags to remove. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `schemeCode` exists in the scope selected by `tenantId`. | `public virtual Task RemoveSchemeTagsInTenantAsync(string schemeCode, string tenantId, params string[] tags)` Removes tags from a source scheme in a specified tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The source scheme code. | | `tenantId` | `String` | The tenant identifier that defines the exact scope. | | `tags` | `String[]` | The scheme tags to remove. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `schemeCode` exists in the scope selected by `tenantId`. | `public virtual Task SetSchemeTagsAsync(string schemeCode, params string[] tags)` Replaces all tags on a source scheme in the shared scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the shared source scheme. | | `tags` | `String[]` | The replacement scheme tags; an empty array removes all tags. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when the shared source scheme identified by `schemeCode` does not exist. | `public virtual Task SetSchemeTagsAsync(string schemeCode, IEnumerable tags)` Replaces all tags on a source scheme in the shared scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the shared source scheme. | | `tags` | `IEnumerable` | The replacement scheme tags; an empty collection removes all tags. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when the shared source scheme identified by `schemeCode` does not exist. | `public virtual Task SetSchemeTagsAsync(string schemeCode, string tenantId, IEnumerable tags)` Replaces all tags on a source scheme in an exact tenant scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The source scheme code. | | `tenantId` | `String` | The tenant identifier that defines the exact scope, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for the shared scope. | | `tags` | `IEnumerable` | The replacement scheme tags; an empty collection removes all tags. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `schemeCode` exists in the scope selected by `tenantId`. | `public virtual Task SetSchemeTagsInTenantAsync(string schemeCode, string tenantId, params string[] tags)` Replaces all tags on a source scheme in a specified tenant. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The source scheme code. | | `tenantId` | `String` | The tenant identifier that defines the exact scope. | | `tags` | `String[]` | The replacement scheme tags; an empty array removes all tags. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Exceptions | Type | Description | | --- | --- | | `SchemeNotFoundException` | Thrown when no source scheme with `schemeCode` exists in the scope selected by `tenantId`. | `public virtual Task GenerateAsync(string schemeCode, string tenantId = null)` Asynchronously generates the source process scheme identified by `schemeCode` in the tenant scope specified by `tenantId`. ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemeCode` | `String` | The code of the process scheme to generate. | | `tenantId` | `String` | The tenant identifier that scopes generation, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) for generation without a tenant scope. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result is the generated source process scheme. | `public virtual Task BulkInitProcessesAsync(List instances, ProcessStatus status, CancellationToken token)` When bulk operations are supported, persists multiple ProcessInstance objects, their persistent parameters, and their initial status. ### Parameters | Name | Type | Description | | --- | --- | --- | | `instances` | `List` | The ProcessInstance objects to persist. | | `status` | `ProcessStatus` | The ProcessStatus to assign to each ProcessInstance. | | `token` | `CancellationToken` | The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) that can cancel the operation. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Remarks Check IPersistenceProvider.IsBulkOperationsSupported before calling this method. `public virtual Task BulkInitProcessesAsync(List instances, List timers, ProcessStatus status, CancellationToken token)` When bulk operations are supported, persists multiple ProcessInstance objects, their persistent parameters, timer registrations, and their initial status. ### Parameters | Name | Type | Description | | --- | --- | --- | | `instances` | `List` | The ProcessInstance objects to persist. | | `timers` | `List` | The TimerToRegister objects to persist. | | `status` | `ProcessStatus` | The ProcessStatus to assign to each ProcessInstance. | | `token` | `CancellationToken` | The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) that can cancel the operation. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | ### Remarks Check IPersistenceProvider.IsBulkOperationsSupported before calling this method. `public virtual Task DropWorkflowInboxAsync(Guid processId)` Removes all approval inbox entries associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose inbox entries are removed. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public virtual Task InsertInboxAsync(List newActors)` Adds approval inbox entries. ### Parameters | Name | Type | Description | | --- | --- | --- | | `newActors` | `List` | | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public Task GetInboxCountByProcessIdAsync(Guid processId)` Gets the number of approval inbox entries associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose inbox entries are counted. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is the number of matching inbox entries. | `public Task GetInboxCountByIdentityIdAsync(string identityId)` Gets the number of approval inbox entries available to the specified workflow participant identity. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity whose inbox entries are counted. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is the number of matching inbox entries. | `public Task> GetInboxByProcessIdAsync(Guid processId, Paging paging = null, CultureInfo culture = null)` Gets approval inbox entries associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose inbox entries are retrieved. | | `paging` | `Paging` | The optional Paging settings that select a page of results. | | `culture` | `CultureInfo` | The [CultureInfo](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo) used to localize the command names in InboxItem.AvailableCommands, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to use [CultureInfo.CurrentCulture](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo.currentculture). | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result contains the matching InboxItem objects. | `public Task> GetInboxByIdentityIdAsync(string identityId, Paging paging = null, CultureInfo culture = null)` Gets approval inbox entries available to the specified workflow participant identity. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity whose inbox entries are retrieved. | | `paging` | `Paging` | The optional Paging settings that select a page of results. | | `culture` | `CultureInfo` | The [CultureInfo](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo) used to localize the command names in InboxItem.AvailableCommands, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to use [CultureInfo.CurrentCulture](https://learn.microsoft.com/dotnet/api/system.globalization.cultureinfo.currentculture). | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result contains the matching InboxItem objects. | `public Task FillApprovalHistoryAsync(ApprovalHistoryItem approvalHistoryItem)` Adds `approvalHistoryItem` to approval history or updates a matching pending entry. ### Parameters | Name | Type | Description | | --- | --- | --- | | `approvalHistoryItem` | `ApprovalHistoryItem` | The ApprovalHistoryItem containing the approval history data to add or apply. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public Task DropApprovalHistoryByProcessIdAsync(Guid processId)` Removes all approval history entries associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose approval history is removed. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public Task DropApprovalHistoryByIdentityIdAsync(string identityId)` Removes approval history entries recorded for the specified executor. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity of the executor whose approval history entries are removed. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public virtual Task DropEmptyApprovalHistoryAsync(Guid processId)` Removes approval history entries that have no ApprovalHistoryItem.TransitionTime and are associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose pending entries are removed. | ### Returns | Type | Description | | --- | --- | | `Task` | A task that represents the asynchronous operation. | `public Task GetApprovalHistoryCountByProcessIdAsync(Guid processId)` Gets the number of approval history entries associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose approval history entries are counted. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is the number of matching approval history entries. | `public Task GetApprovalHistoryCountByIdentityIdAsync(string identityId)` Gets the number of approval history entries recorded for the specified executor. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity of the executor whose approval history entries are counted. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is the number of matching approval history entries. | `public Task> GetApprovalHistoryByProcessIdAsync(Guid processId, Paging paging = null)` Gets approval history entries associated with the specified process instance. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the process instance whose approval history is retrieved. | | `paging` | `Paging` | The optional Paging settings that select a page of results. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result contains the matching ApprovalHistoryItem objects. | `public Task> GetApprovalHistoryByIdentityIdAsync(string identityId, Paging paging = null)` Gets approval history entries recorded for the specified executor. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity of the executor whose approval history is retrieved. | | `paging` | `Paging` | The optional Paging settings that select a page of results. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result contains the matching ApprovalHistoryItem objects. | `public Task GetOutboxCountByIdentityIdAsync(string identityId)` Gets the number of process-specific OutboxItem summaries for the specified executor. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity of the executor whose approval history is summarized. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result is the number of process-specific approval summaries. | `public Task> GetOutboxByIdentityIdAsync(string identityId, Paging paging = null)` Gets process-specific OutboxItem summaries of approvals performed by the specified executor. ### Parameters | Name | Type | Description | | --- | --- | --- | | `identityId` | `String` | The workflow participant identity of the executor whose approval history is summarized. | | `paging` | `Paging` | The optional Paging settings that select a page of results. | ### Returns | Type | Description | | --- | --- | | `Task` | A task whose result contains the matching OutboxItem objects. | `public Task GetFormAsync(string name, int? version = null, string tenantId = null)` Gets a form by name and optional version. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `version` | `Nullable` | The form version, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to retrieve the latest available version. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to read from the shared scope. When specified, latest-version reads prefer the tenant scope and use the shared scope only when the tenant scope contains no forms with the specified name. Version-specific reads use the shared scope only when the tenant scope contains no versions of the form. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result contains the matching WorkflowForm, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when no matching form is found. | `public Task> GetFormNamesAsync(string tenantId = null)` Gets the distinct form names available in the selected scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to read from the shared scope. When specified, the result combines names from the tenant and shared scopes. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result contains the distinct form names available in the selected scope. | `public Task> GetFormVersionsAsync(string name, string tenantId = null)` Gets the distinct versions of a form available in the selected scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to read from the shared scope. When specified, the result contains tenant-scoped versions when the tenant scope contains the form; otherwise it contains shared versions. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result contains the distinct form version numbers available in the selected scope. | `public Task CreateNewFormVersionAsync(string name, string defaultDefinition, int? version = null, string tenantId = null)` Creates a new version of a form in the selected scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `defaultDefinition` | `String` | The form definition to use when `version` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) and no source form is available in the target scope or, when initializing a tenant scope, the shared scope. | | `version` | `Nullable` | The source form version whose definition is copied, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to use the latest source form. A specified version must exist in the target scope, or in the shared scope when initializing an empty tenant scope. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to create the version in the shared scope. When creating the first version in a tenant scope, the definition may be copied from the shared scope. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result contains the newly created WorkflowForm. | `public Task CreateNewFormIfNotExistsAsync(string name, string defaultDefinition, string tenantId = null)` Gets the latest form in the selected scope, or creates version 0 when the scope contains no form with the specified name. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `defaultDefinition` | `String` | The definition to use for a newly created form when no shared form is available as a source. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to use the shared scope. A new tenant-scoped form uses the shared form definition when one is available. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result contains the existing or newly created WorkflowForm. | `public Task UpdateFormAsync(string name, int version, int lockValue, string definition, string tenantId = null)` Updates a form version's definition using optimistic concurrency. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `version` | `Int32` | The form version to update. | | `lockValue` | `Int32` | The expected current lock value for optimistic concurrency. | | `definition` | `String` | The new form definition. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to update the shared scope. The update is limited to the selected scope. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1) whose result contains the new lock value. | `public Task DeleteFormVersionAsync(string name, int version, string tenantId = null)` Deletes a specific version of a form from the selected scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `version` | `Int32` | The form version to delete. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to delete from the shared scope. The deletion is limited to the selected scope. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `public Task DeleteFormAsync(string name, string tenantId = null)` Deletes all versions of a form from the selected scope. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | The form name. | | `tenantId` | `String` | The tenant identifier, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to delete from the shared scope. The deletion is limited to the selected scope. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | [Previous ProcessInstanceTree](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/ProcessInstanceTree/) [Next WorkflowApprovalHistory](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/WorkflowApprovalHistory/)