# Interface IPersistenceProvider OptimaJet.Workflow.Core.Persistence.IPersistenceProvider Defines the persistence operations used by [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) to store and load process checkpoints, global parameters, timers, and runtime operational state. Namespace: [OptimaJet.Workflow.Core.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/) ```csharp public interface IPersistenceProvider : IApprovalProvider, IFormDataProvider ``` ## Type Hierarchy - IPersistenceProvider Current type - Base interfaces - [IApprovalProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IApprovalProvider/) - [IFormDataProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IFormDataProvider/) - Derived interfaces - [IWorkflowProvider](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IWorkflowProvider/) - Implementing types - [MongoDBProvider](https://api.workflowengine.io/mongodb/OptimaJet.Workflow.MongoDB/MongoDBProvider/) - [MSSQLProvider](https://api.workflowengine.io/sql-server/OptimaJet.Workflow.DbPersistence/MSSQLProvider/) - [FileSchemePersistenceMSSQLProvider](https://api.workflowengine.io/sql-server/OptimaJet.Workflow.DbPersistence/FileSchemePersistenceMSSQLProvider/) - [MySQLProvider](https://api.workflowengine.io/mysql/OptimaJet.Workflow.MySQL/MySQLProvider/) - [OracleProvider](https://api.workflowengine.io/oracle/OptimaJet.Workflow.Oracle/OracleProvider/) - [FileSchemePersistenceOracleProvider](https://api.workflowengine.io/oracle/OptimaJet.Workflow.Oracle/FileSchemePersistenceOracleProvider/) - [PostgreSQLProvider](https://api.workflowengine.io/postgresql/OptimaJet.Workflow.PostgreSQL/PostgreSQLProvider/) - [FileSchemePersistencePostgreSQLProvider](https://api.workflowengine.io/postgresql/OptimaJet.Workflow.PostgreSQL/FileSchemePersistencePostgreSQLProvider/) - [SqliteProvider](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/SqliteProvider/) - [FileSchemePersistenceSqliteProvider](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/FileSchemePersistenceSqliteProvider/) ## Properties `string Id { get; }` Gets the identifier of the persistence provider implementation. `string ConnectionString { get; }` Gets the connection string configured for the persistence provider. `bool IsBulkOperationsSupported { get; }` Gets a value indicating whether the provider supports bulk process initialization. ## Methods `void Init(WorkflowRuntime runtime)` Initializes the persistence provider for a [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtime` | `WorkflowRuntime` | The [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) that uses this provider. | `Task InitializeProcessAsync(ProcessInstance processInstance)` Creates the persisted process instance record for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) of `processInstance`. | `Task FillProcessParametersAsync(ProcessInstance processInstance)` Loads [ParameterPurpose.System](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) and [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) process parameters into a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) to populate. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `Task FillPersistedProcessParametersAsync(ProcessInstance processInstance)` Loads all [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) process parameters into a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) to populate. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `Task FillPersistedProcessParameterAsync(ProcessInstance processInstance, string parameterName)` Loads one [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) process parameter into a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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. | `Task FillSystemProcessParametersAsync(ProcessInstance processInstance)` Loads [ParameterPurpose.System](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) process parameters into a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) to populate. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `Task SavePersistenceParametersAsync(ProcessInstance processInstance)` Saves changed process parameters whose purpose is [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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). | `Task SavePersistenceParameterAsync(ProcessInstance processInstance, string parameterName)` Saves one modified process parameter whose purpose is [ParameterPurpose.Persistence](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ParameterPurpose/) parameter named `parameterName` is available to save. | `Task RemoveParameterAsync(ProcessInstance processInstance, string parameterName)` Deletes the persisted value of a named process parameter. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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. | `Task SetWorkflowInitializedAsync(ProcessInstance processInstance)` Sets the process instance status to [ProcessStatus.Initialized](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) cannot be changed. | `Task SetWorkflowIdledAsync(ProcessInstance processInstance)` Sets the process instance status to [ProcessStatus.Idled](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) cannot be changed. | `Task SetWorkflowRunningAsync(ProcessInstance processInstance)` Sets the process instance status to [ProcessStatus.Running](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) cannot be changed. | `Task SetWorkflowFinalizedAsync(ProcessInstance processInstance)` Sets the process instance status to [ProcessStatus.Finalized](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) cannot be changed. | `Task SetProcessStatusAsync(Guid processId, ProcessStatus newStatus)` Sets the [ProcessStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) of a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | | `newStatus` | `ProcessStatus` | The [ProcessStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) cannot be changed. | `Task SetWorkflowTerminatedAsync(ProcessInstance processInstance)` Sets the process instance status to [ProcessStatus.Terminated](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) cannot be changed. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) that completed the transition. | | `transition` | `TransitionDefinition` | The executed [TransitionDefinition](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/) and [ActivityDefinition.DisablePersistTransitionHistory](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ActivityDefinition/). `Task IsProcessExistsAsync(Guid processId)` Determines whether a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) exists; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `Task IsProcessExistsAsync(Guid processId, string tenantId)` Determines whether a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) exists for the tenant; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `Task GetInstanceStatusAsync(Guid processId)` Gets the [ProcessStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) of a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The persisted [ProcessStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/), [ProcessStatus.NotFound](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) when the process has no status record, or [ProcessStatus.Unknown](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) when the persisted status is not recognized. | `Task BindProcessToNewSchemeAsync(ProcessInstance processInstance)` Updates a persisted [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) to reference its new process scheme. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processInstance` | `ProcessInstance` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) whose [ProcessInstance.ProcessScheme](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) of `processInstance`. | `Task RegisterTimerAsync(Guid processId, Guid rootProcessId, string name, DateTime nextExecutionDateTime, string tenantId, bool notOverrideIfExists)` Creates or updates a persisted timer registration for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The identifier of the [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/TimerDefinition/). | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `Task ClearTimersAsync(Guid processId, List timersIgnoreList)` Deletes all persisted timer registrations for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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. | `Task> GetTimersForProcessAsync(Guid processId)` Gets all persisted timer registrations for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The [ProcessTimer](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/ProcessTimer/) objects registered for the [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). | `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. | `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. | `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. | `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. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task` | A mapping from parameter names to values. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | The parameter values. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Paging/) settings. | | `name` | `String` | The optional parameter-name filter. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | A [PagedResponse](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PagedResponse-T/) containing the selected parameter values and total matching count. | `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. | `Task SaveTenantGlobalParameterAsync(TenantGlobalParameterKey key, T value)` Saves a global parameter value in the tenant scope specified by a [TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `key` | `TenantGlobalParameterKey` | The [TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/). Its [TenantGlobalParameterKey.Name](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/) 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. | `Task LoadTenantGlobalParameterAsync(TenantGlobalParameterKey key)` Loads a global parameter value from the tenant scope specified by a [TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `key` | `TenantGlobalParameterKey` | The [TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/). Its [TenantGlobalParameterKey.Name](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/) 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. | `Task> LoadTenantGlobalParametersWithNamesAsync(TenantGlobalParameterScope scope, Sorting sort = null)` Loads global parameter names and values from a [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/) to load. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task` | A mapping from parameter names to values. | `Task> LoadTenantGlobalParametersAsync(TenantGlobalParameterScope scope, Sorting sort = null)` Loads global parameter values from a [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/) to load. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | The parameter values. | `Task> LoadTenantGlobalParametersWithPagingAsync(TenantGlobalParameterScope scope, Paging paging, Sorting sort = null)` Loads a page of global parameter values from a [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/) and the total matching count. ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/) to load. | | `paging` | `Paging` | The [Paging](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Paging/) settings. | | `sort` | `Sorting` | The optional [Sorting](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Sorting/) settings. | ### Returns | Type | Description | | --- | --- | | `Task>` | A [PagedResponse](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/PagedResponse-T/) containing the selected parameter values and total matching count. | `Task DeleteTenantGlobalParametersAsync(TenantGlobalParameterScope scope)` Deletes all global parameters in a [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `scope` | `TenantGlobalParameterScope` | The [TenantGlobalParameterScope](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterScope/) to delete. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `Task DeleteTenantGlobalParameterAsync(TenantGlobalParameterKey key)` Deletes one global parameter identified by a [TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `key` | `TenantGlobalParameterKey` | The [TenantGlobalParameterKey](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/TenantGlobalParameterKey/) to delete. | ### Returns | Type | Description | | --- | --- | | `Task` | A [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation. | `Task> GetProcessHistoryAsync(Guid processId, Paging paging = null)` Gets persisted transition history for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | | `paging` | `Paging` | The optional [Paging](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Paging/) settings. | ### Returns | Type | Description | | --- | --- | | `Task` | The persisted [ProcessHistoryItem](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/ProcessHistoryItem/) records. | `Task GetProcessHistoryCountAsync(Guid processId)` Gets the number of persisted transition history records for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of persisted transition history records. | `Task BulkInitProcessesAsync(List instances, ProcessStatus status, CancellationToken token)` When bulk operations are supported, persists multiple [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects, their persistent parameters, and their initial status. ### Parameters | Name | Type | Description | | --- | --- | --- | | `instances` | `List` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects to persist. | | `status` | `ProcessStatus` | The [ProcessStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) to assign to each [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IPersistenceProvider/) before calling this method. `Task BulkInitProcessesAsync(List instances, List timers, ProcessStatus status, CancellationToken token)` When bulk operations are supported, persists multiple [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects, their persistent parameters, timer registrations, and their initial status. ### Parameters | Name | Type | Description | | --- | --- | --- | | `instances` | `List` | The [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects to persist. | | `timers` | `List` | The [TimerToRegister](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/TimerToRegister/) objects to persist. | | `status` | `ProcessStatus` | The [ProcessStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/) to assign to each [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IPersistenceProvider/) before calling this method. `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IProcessInstanceTreeItem/) records in the process instance tree. | `Task MultiServerRuntimesExistAsync()` Determines whether persistence contains a multi-server [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) record whose status is neither [RuntimeStatus.Dead](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/) nor [RuntimeStatus.Terminated](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/). ### Returns | Type | Description | | --- | --- | | `Task` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when such a [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) record exists; otherwise, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool). | `Task CreateWorkflowRuntimeAsync(string runtimeId, RuntimeStatus status)` Creates a persisted operational record for a [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeId` | `String` | The runtime identifier. | | `status` | `RuntimeStatus` | The initial [RuntimeStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/). | ### Returns | Type | Description | | --- | --- | | `Task` | The created [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/). | `Task UpdateWorkflowRuntimeStatusAsync(WorkflowRuntimeModel runtime, RuntimeStatus status)` Updates the persisted status of a [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) using its concurrency token. ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtime` | `WorkflowRuntimeModel` | The [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) containing the current [WorkflowRuntimeModel.Lock](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/). | | `status` | `RuntimeStatus` | The new [RuntimeStatus](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/). | ### Returns | Type | Description | | --- | --- | | `Task` | The updated [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/). | ### Exceptions | Type | Description | | --- | --- | | `ImpossibleToSetRuntimeStatusException` | The [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) cannot be updated with the supplied concurrency token. | `Task<(bool Success, WorkflowRuntimeModel UpdatedModel)> UpdateWorkflowRuntimeRestorerAsync(WorkflowRuntimeModel runtime, string restorerId)` Attempts to assign a [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) to restore processes associated with another [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtime` | `WorkflowRuntimeModel` | The [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) containing the current [WorkflowRuntimeModel.Lock](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/). | | `restorerId` | `String` | The runtime identifier to store in [WorkflowRuntimeModel.RestorerId](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/). | ### Returns | Type | Description | | --- | --- | | `Task` | A result that indicates whether the update succeeded and contains the updated [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) when it did. | `Task> GetRunningProcessesAsync(string runtimeId = null)` Gets the identifiers of [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects whose status is [ProcessStatus.Running](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessStatus/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeId` | `String` | The optional runtime identifier used to filter the [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) or an empty string to include all [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) instances. | ### Returns | Type | Description | | --- | --- | | `Task` | The identifiers of the matching [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) objects. | `Task> GetActiveTimersForProcessAsync(Guid processId)` Gets the timer registrations for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/) that have not been marked as ignored. ### Parameters | Name | Type | Description | | --- | --- | --- | | `processId` | `Guid` | The process identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The active [ProcessTimer](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/ProcessTimer/) objects registered for the [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/ProcessInstance/). | `Task DeleteInactiveTimersByProcessIdAsync(Guid processId)` Deletes timer registrations for a [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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. | `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. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowTimer/) objects in execution-time order. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentException` | `top` is not greater than zero. | `Task SetTimerIgnoreAsync(Guid id)` Marks a persisted timer registration as ignored so it is not selected for execution. ### Parameters | Name | Type | Description | | --- | --- | --- | | `id` | `Guid` | The timer registration identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of timer records changed. | `Task ActiveMultiServerRuntimesCountAsync(string currentRuntimeId)` Counts multi-server [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) records whose status is [RuntimeStatus.Alive](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/), [RuntimeStatus.Restore](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/), or [RuntimeStatus.SelfRestore](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/), 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) records. | `Task GetWorkflowRuntimeModelAsync(string runtimeId)` Gets the persisted operational model for a [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `runtimeId` | `String` | The runtime identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The persisted [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/), or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) when no matching runtime record exists. | `Task> GetWorkflowRuntimesAsync()` Gets all persisted [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) records. ### Returns | Type | Description | | --- | --- | | `Task` | The persisted [WorkflowRuntimeModel](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) objects. | `Task SendRuntimeLastAliveSignalAsync()` Updates [WorkflowRuntimeModel.LastAliveSignal](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/WorkflowRuntimeModel/) for the current [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) when its status is [RuntimeStatus.Alive](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/) or [RuntimeStatus.SelfRestore](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/RuntimeStatus/). ### Returns | Type | Description | | --- | --- | | `Task` | The number of runtime records changed. | `Task GetNextTimerDateAsync(TimerCategory timerCategory, int timerInterval)` Attempts to reserve the next timer polling time for a [TimerCategory](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Timers/TimerCategory/) in multi-server mode. ### Parameters | Name | Type | Description | | --- | --- | --- | | `timerCategory` | `TimerCategory` | The [TimerCategory.Timer](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Timers/TimerCategory/) or [TimerCategory.ServiceTimer](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Timers/TimerCategory/) 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/WorkflowRuntime/) changed the coordination lock first. | `Task DeleteWorkflowRuntimeAsync(string name)` Deletes a persisted [WorkflowRuntime](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime/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. | `Task DropUnusedWorkflowProcessSchemeAsync()` Deletes obsolete compiled process schemes that are not referenced by persisted [ProcessInstance](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Model/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. | `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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Paging/) settings. | ### Returns | Type | Description | | --- | --- | | `Task` | The selected [ProcessInstanceItem](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/ProcessInstanceItem/) records. | `Task GetProcessInstancesCountAsync()` Gets the total number of persisted process instance records. ### Returns | Type | Description | | --- | --- | | `Task` | The number of persisted process instance records. | `Task> GetSchemesAsync(List<(string parameterName, SortDirection sortDirection)> orderParameters, Paging paging)` 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/SortDirection/) values. | | `paging` | `Paging` | The [Paging](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/Paging/) settings. | ### Returns | Type | Description | | --- | --- | | `Task` | The selected [SchemeItem](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/SchemeItem/) records. | `Task GetSchemesCountAsync()` Gets the total number of persisted workflow scheme records. ### Returns | Type | Description | | --- | --- | | `Task` | The number of persisted workflow scheme records. | [Previous InboxItem](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/InboxItem/) [Next IProcessInstanceTreeItem](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Persistence/IProcessInstanceTreeItem/)