Database Provider
Data provider services in the Web API implement operations defined by the core services. There are currently six providers available, depending on the database management system (DBMS) you prefer.
Data provider services do not provide working API operations by themselves; building operations is handled by core services, so make sure to include them.
Integration
- MS SQL Server
- MySQL
- Oracle
- PostgreSQL
- SQLite
- MongoDB
The database provider is distributed as a separate NuGet package. Add it to your project with the following command:
dotnet add package OptimaJet.Workflow.Api.Mssql
Add the provider during application startup by using an extension method on IServiceCollection:
builder.Services.AddWorkflowApiMssql();
You have now integrated the Web API data provider service.
The database provider is distributed as a separate NuGet package. Add it to your project with the following command:
dotnet add package OptimaJet.Workflow.Api.Mysql
Add the provider during application startup by using an extension method on IServiceCollection:
builder.Services.AddWorkflowApiMysql();
You have now integrated the Web API data provider service.
The database provider is distributed as a separate NuGet package. Add it to your project with the following command:
dotnet add package OptimaJet.Workflow.Api.Oracle
Add the provider during application startup by using an extension method on IServiceCollection:
builder.Services.AddWorkflowApiOracle();
You have now integrated the Web API data provider service.
The database provider is distributed as a separate NuGet package. Add it to your project with the following command:
dotnet add package OptimaJet.Workflow.Api.Postgres
Add the provider during application startup by using an extension method on IServiceCollection:
builder.Services.AddWorkflowApiPostgres();
You have now integrated the Web API data provider service.
The database provider is distributed as a separate NuGet package. Add it to your project with the following command:
dotnet add package OptimaJet.Workflow.Api.Sqlite
This version of SQLite may not work on macOS with Apple Silicon processors.
Add the provider during application startup by using an extension method on IServiceCollection:
builder.Services.AddWorkflowApiSqlite();
You have now integrated the Web API data provider service.
The database provider is distributed as a separate NuGet package. Add it to your project with the following command:
dotnet add package OptimaJet.Workflow.Api.Mongo
Add the provider during application startup by using an extension method on IServiceCollection:
builder.Services.AddWorkflowApiMongo();
You have now integrated the Web API data provider service.
Data Provider Options
You can configure data provider options by using the DataProviderCreationOptions property on
WorkflowTenantCreationOptions. In single-tenant mode, this configuration is applied when the Workflow Runtime
is initialized. In multi-tenant mode, it is applied separately for each tenant during registration. Below are the
available options for each provider:
- MS SQL Server
- MySql
- Oracle
- PostgreSQL
- SQLite
- MongoDB
| Name | Type | Default | Description | 
|---|---|---|---|
| DatabaseSchema | string? | "dbo" | The schema to which the provider's queries will be executed. If null is specified, the default will be used. | 
| CommandTimeout | int | 30 | The timeout for command execution by the driver, in seconds. | 
| ExceptionHandler | Action<Exception> | _ => {} | Delegate called before throwing an SQL exception within the provider. The encountered exception is passed as an argument. | 
| LogQueryAction | Action<string> | _ => {} | Delegate called after preparing the query for execution, with the SQL string passed as argument. Query parameters replaced with the '?' placeholder. | 
| Name | Type | Default | Description | 
|---|---|---|---|
| CommandTimeout | int | 30 | The timeout for command execution by the driver, in seconds. | 
| ExceptionHandler | Action<Exception> | _ => {} | Delegate called before throwing an SQL exception within the provider. The encountered exception is passed as an argument. | 
| LogQueryAction | Action<string> | _ => {} | Delegate called after preparing the query for execution, with the SQL string passed as argument. Query parameters replaced with the '?' placeholder. | 
| Name | Type | Default | Description | 
|---|---|---|---|
| DatabaseSchema | string? | null | The schema to which the provider's queries will be executed. If null is specified, the default will be used. | 
| CommandTimeout | int | 30 | The timeout for command execution by the driver, in seconds. | 
| ExceptionHandler | Action<Exception> | _ => {} | Delegate called before throwing an SQL exception within the provider. The encountered exception is passed as an argument. | 
| LogQueryAction | Action<string> | _ => {} | Delegate called after preparing the query for execution, with the SQL string passed as argument. Query parameters replaced with the '?' placeholder. | 
| Name | Type | Default | Description | 
|---|---|---|---|
| DatabaseSchema | string? | "public" | The schema to which the provider's queries will be executed. If null is specified, the default will be used. | 
| CommandTimeout | int | 30 | The timeout for command execution by the driver, in seconds. | 
| ExceptionHandler | Action<Exception> | _ => {} | Delegate called before throwing an SQL exception within the provider. The encountered exception is passed as an argument. | 
| LogQueryAction | Action<string> | _ => {} | Delegate called after preparing the query for execution, with the SQL string passed as argument. Query parameters replaced with the '?' placeholder. | 
| Name | Type | Default | Description | 
|---|---|---|---|
| DatabaseSchema | string? | "main" | The schema to which the provider's queries will be executed. If null is specified, the default will be used. | 
| CommandTimeout | int | 30 | The timeout for command execution by the driver, in seconds. | 
| ExceptionHandler | Action<Exception> | _ => {} | Delegate called before throwing an SQL exception within the provider. The encountered exception is passed as an argument. | 
| LogQueryAction | Action<string> | _ => {} | Delegate called after preparing the query for execution, with the SQL string passed as argument. Query parameters replaced with the '?' placeholder. | 
The MongoDB provider currently does not support any options.
IWorkflowTenantProvider
Interface for providing workflow tenants in a multi-tenant setup.
Has a default implementation ListWorkflowTenantProvider that can be used to register list of tenants.
Tenants
An array of tenants to be registered in the Workflow Engine Web API.
Returns
| Type | Description | 
|---|---|
| IWorkflowTenant[] | An array of workflow tenants. | 
IProviderFactoryRegistry
Interface for a registry that manages and provides access to different providers factories
Get
Gets the provider factory for the specified database provider identifier. Default identifiers are stored in
Core.PersistenceProviderId.
| Parameter | Type | Description | 
|---|---|---|
| providerId | string? | The identifier of the database provider (DBMS). If null, the default factory is returned. | 
Returns
| Type | Description | 
|---|---|
| IProviderFactory | The corresponding IProviderFactoryinstance, or the default factory if providerId is null. | 
GetDefault
Gets the first registered provider factory as the default.
Returns
| Type | Description | 
|---|---|
| IProviderFactory | The default IProviderFactoryinstance. | 
IProviderFactory
Interface for provider abstract factory used to create data provider and workflow provider implementations.
PersistenceProviderId
The identifier of the database management system, for which this factory creates providers. Default identifiers
are stored in Core.PersistenceProviderId.
Returns
| Type | Description | 
|---|---|
| string | The persistence provider identifier. | 
CreateDataProvider
Creates a data provider for the specified connection string and options.
| Parameter | Type | Description | 
|---|---|---|
| connectionString | string | The connection string to the database. | 
| options | DataProviderCreationOptions | The options for configuring the data provider. | 
Returns
| Type | Description | 
|---|---|
| IDataProvider | An instance of IDataProvider. | 
CreateWorkflowProvider
Creates a workflow provider with the specified options.
| Parameter | Type | Description | 
|---|---|---|
| options | PersistenceProviderOptions | The options for configuring the workflow provider. | 
Returns
| Type | Description | 
|---|---|
| IWorkflowProvider | An instance of IWorkflowProvider. |