# Class WorkflowRuntime OptimaJet.Workflow.SQLite.Models.WorkflowRuntime Database object for workflow runtime status and multi-server coordination operations. Namespace: [OptimaJet.Workflow.SQLite.Models](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite.Models/) ```csharp public class WorkflowRuntime : DbObject ``` ## Type Hierarchy - [DbObject](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite/DbObject-TEntity/) - WorkflowRuntime Current type ## Constructors `public WorkflowRuntime(string schemaName, int commandTimeout)` Initializes a new instance of [WorkflowRuntime](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite.Models/WorkflowRuntime/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `schemaName` | `String` | The database schema name. | | `commandTimeout` | `Int32` | The command timeout in seconds. | ## Methods `public Task UpdateStatusAsync(SqliteConnection connection, WorkflowRuntimeModel status, Guid oldLock)` Updates the runtime status using optimistic locking. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `status` | `WorkflowRuntimeModel` | The runtime model with the new status. | | `oldLock` | `Guid` | The current lock value for optimistic concurrency. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of rows affected. | `public Task UpdateRestorerAsync(SqliteConnection connection, WorkflowRuntimeModel status, Guid oldLock)` Updates the runtime restorer identifier using optimistic locking. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `status` | `WorkflowRuntimeModel` | The runtime model with the new restorer. | | `oldLock` | `Guid` | The current lock value for optimistic concurrency. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of rows affected. | `public Task MultiServerRuntimesExistAsync(SqliteConnection connection)` Checks whether multiple active workflow runtimes exist in the database. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | ### Returns | Type | Description | | --- | --- | | `Task` | `true` if more than one active runtime exists; otherwise, `false`. | `public Task GetActiveMultiServerRuntimesCountAsync(SqliteConnection connection, string currentRuntimeId)` Returns the count of active runtimes excluding the current one. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `currentRuntimeId` | `String` | The current runtime identifier to exclude. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of other active runtimes. | `public Task GetWorkflowRuntimeStatusAsync(SqliteConnection connection, string runtimeId)` Gets the runtime status model for the specified runtime identifier. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `runtimeId` | `String` | The runtime identifier. | ### Returns | Type | Description | | --- | --- | | `Task` | The runtime model, or `null` if not found. | `public Task SendRuntimeLastAliveSignalAsync(SqliteConnection connection, string runtimeId, DateTime time)` Updates the last alive signal timestamp for the specified runtime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `runtimeId` | `String` | The runtime identifier. | | `time` | `DateTime` | The timestamp of the alive signal. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of rows affected. | `public Task UpdateNextTimeAsync(SqliteConnection connection, string runtimeId, string nextTimeColumnName, DateTime time, SqliteTransaction transaction = null)` Updates the next timer time column for the specified runtime. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `runtimeId` | `String` | The runtime identifier. | | `nextTimeColumnName` | `String` | The name of the next time column to update. | | `time` | `DateTime` | The new next time value. | | `transaction` | `SqliteTransaction` | An optional transaction. | ### Returns | Type | Description | | --- | --- | | `Task` | The number of rows affected. | `public Task GetMaxNextTimeAsync(SqliteConnection connection, string runtimeId, string nextTimeColumnName)` Gets the maximum next timer time across all other active runtimes. ### Parameters | Name | Type | Description | | --- | --- | --- | | `connection` | `SqliteConnection` | The SQLite connection. | | `runtimeId` | `String` | The current runtime identifier to exclude. | | `nextTimeColumnName` | `String` | The name of the next time column to query. | ### Returns | Type | Description | | --- | --- | | `Task` | The maximum next time, or `null` if no other active runtimes exist. | [Previous WorkflowForm](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite.Models/WorkflowForm/) [Next WorkflowSync](https://api.workflowengine.io/sqlite/OptimaJet.Workflow.SQLite.Models/WorkflowSync/)