Class WorkflowForm
OptimaJet.Workflow.SQLite.Models.WorkflowForm
Database object for workflow form storage and versioning operations.
Namespace: OptimaJet.Workflow.SQLite.Models
public class WorkflowForm : DbObject<WorkflowFormEntity>Inheritance
- Object
- DbObject<WorkflowFormEntity>
Constructors
public WorkflowForm(string schemaName, int commandTimeout) #Initializes a new instance of WorkflowForm.
Parameters
Name
Type
Description
schemaNameStringThe database schema name.
commandTimeoutInt32The command timeout in seconds.
Methods
public Task<List<string>> GetFormNamesAsync(SqliteConnection connection, string tenantId = null) #Gets the distinct list of form names accessible in the specified tenant scope.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
tenantIdStringThe tenant identifier, or
null for shared forms only.Returns
Type
Description
Task<String>A list of form names.
public Task<WorkflowFormEntity> GetFormAsync(SqliteConnection connection, string name, int? version = null, string tenantId = null) #Gets a form entity by name and optional version within the specified tenant scope.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
nameStringThe form name.
versionNullable<Int32>The form version, or
null to get the latest version.tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
Task<WorkflowFormEntity>The form entity if found; otherwise,
null.public Task<List<int>> GetFormVersionsAsync(SqliteConnection connection, string name, string tenantId = null) #Gets the list of distinct form versions for the specified form name within the tenant scope.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
nameStringThe form name.
tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
Task<Int32>A list of version numbers.
public Task<WorkflowFormEntity> CreateNewFormVersionAsync(SqliteConnection connection, DateTime creationDate, string name, string defaultDefinition, int? version = null, string tenantId = null) #Creates a new version of the form. If
version is specified, copies the definition from that version; otherwise copies from the latest version. Falls back to the shared form if the tenant-scoped form is not found.Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
creationDateDateTimeThe creation date for the new version.
nameStringThe form name.
defaultDefinitionStringThe default definition to use if no source version is found.
versionNullable<Int32>The source version to copy from, or
null to copy from the latest.tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
Task<WorkflowFormEntity>The newly created form entity, or
null if the specified source version was not found.public Task<WorkflowFormEntity> CreateNewFormIfNotExistsAsync(SqliteConnection connection, DateTime creationDate, string name, string defaultDefinition, string tenantId = null) #Creates a new form with version 0 if a form with the specified name does not already exist in the given tenant scope. Falls back to the shared form definition if the tenant-scoped form is not found.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
creationDateDateTimeThe creation date for the new form.
nameStringThe form name.
defaultDefinitionStringThe default definition to use if no shared form exists.
tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
Task<WorkflowFormEntity>The existing or newly created form entity.
public Task<int> UpdateFormAsync(SqliteConnection connection, string name, int version, long oldLock, long newLock, string definition, DateTime updatedDate, string tenantId = null) #Updates the form definition with optimistic locking.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
nameStringThe form name.
versionInt32The form version to update.
oldLockInt64The current lock value for optimistic concurrency.
newLockInt64The new lock value to set.
definitionStringThe new form definition.
updatedDateDateTimeThe update timestamp.
tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
Task<Int32>The new lock value if the update succeeded.
public Task DeleteFormVersionAsync(SqliteConnection connection, string name, int version, string tenantId = null) #Deletes a specific version of the form within the specified tenant scope.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
nameStringThe form name.
versionInt32The version to delete.
tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
TaskA task that represents the asynchronous operation.
public Task DeleteFormAsync(SqliteConnection connection, string name, string tenantId = null) #Deletes all versions of the form within the specified tenant scope.
Parameters
Name
Type
Description
connectionSqliteConnectionThe SQLite connection.
nameStringThe form name.
tenantIdStringThe tenant identifier, or
null for shared forms.Returns
Type
Description
TaskA task that represents the asynchronous operation.