Class MongoDBProvider
OptimaJet.Workflow.MongoDB.MongoDBProvider
Namespace: OptimaJet.Workflow.MongoDB
public class MongoDBProvider : IWorkflowProvider, IPersistenceProvider, IApprovalProvider, IFormDataProvider, ISchemePersistenceProvider<XElement>, IWorkflowGenerator<XElement>Type Hierarchy
- MongoDBProvider Current type
Constructors
public MongoDBProvider(string connectionString, bool writeToHistory = true, bool writeSubProcessToRoot = false) #Parameters
Name
Type
Description
connectionStringStringwriteToHistoryBooleanwriteSubProcessToRootBooleanProperties
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 IMongoDatabase Store { get; set; } #public bool IsBulkOperationsSupported { get; } #Gets a value indicating whether the provider supports bulk process initialization.
Methods
public void Init(WorkflowRuntime runtime) #Initializes the persistence provider for a WorkflowRuntime.
Parameters
Name
Type
Description
runtimeWorkflowRuntimeThe 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
processIdGuidThe process identifier.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task DeleteTimerAsync(Guid timerId) #Deletes a persisted timer registration.
Parameters
Name
Type
Description
timerIdGuidThe timer registration identifier.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task<List<Guid>> GetRunningProcessesAsync(string runtimeId = null) #Gets the identifiers of ProcessInstance objects whose status is ProcessStatus.Running.
Parameters
Name
Type
Description
runtimeIdStringThe optional runtime identifier used to filter the ProcessInstance objects, or null or an empty string to include all WorkflowRuntime instances.
Returns
Type
Description
Task<Guid>The identifiers of the matching ProcessInstance objects.
public virtual Task<WorkflowRuntimeModel> CreateWorkflowRuntimeAsync(string runtimeId, RuntimeStatus status) #Creates a persisted operational record for a WorkflowRuntime.
Parameters
Name
Type
Description
runtimeIdStringThe runtime identifier.
statusRuntimeStatusThe initial RuntimeStatus.
Returns
Type
Description
Task<WorkflowRuntimeModel>The created WorkflowRuntimeModel.
public virtual Task DeleteWorkflowRuntimeAsync(string name) #Deletes a persisted WorkflowRuntime record.
Parameters
Name
Type
Description
nameStringThe runtime identifier.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public 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
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
NotImplementedExceptionThe provider does not support cleanup of unused compiled process schemes.
public virtual Task<List<ProcessInstanceItem>> 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
orderParametersList<String, SortDirection>The ordered list of persisted field names and corresponding SortDirection values, or null to use the provider's default ordering.
pagingPagingThe optional Paging settings.
Returns
Type
Description
Task<ProcessInstanceItem>The selected ProcessInstanceItem records.
public virtual Task<int> GetProcessInstancesCountAsync() #Gets the total number of persisted process instance records.
Returns
Type
Description
Task<Int32>The number of persisted process instance records.
public virtual Task<List<SchemeItem>> 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
orderParametersList<String, SortDirection>The ordered list of persisted field names and corresponding SortDirection values.
pagingPagingThe Paging settings.
Returns
Type
Description
Task<SchemeItem>The selected SchemeItem records.
public virtual Task<int> GetSchemesCountAsync() #Gets the total number of persisted workflow scheme records.
Returns
Type
Description
Task<Int32>The number of persisted workflow scheme records.
public virtual Task<WorkflowRuntimeModel> UpdateWorkflowRuntimeStatusAsync(WorkflowRuntimeModel runtime, RuntimeStatus status) #Updates the persisted status of a WorkflowRuntime using its concurrency token.
Parameters
Name
Type
Description
runtimeWorkflowRuntimeModelThe WorkflowRuntimeModel containing the current WorkflowRuntimeModel.Lock.
statusRuntimeStatusThe new RuntimeStatus.
Returns
Type
Description
Task<WorkflowRuntimeModel>The updated WorkflowRuntimeModel.
Exceptions
Type
Description
ImpossibleToSetRuntimeStatusExceptionThe 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
runtimeWorkflowRuntimeModelThe WorkflowRuntimeModel containing the current WorkflowRuntimeModel.Lock.
restorerIdStringThe runtime identifier to store in WorkflowRuntimeModel.RestorerId.
Returns
Type
Description
Task<Boolean, WorkflowRuntimeModel>A result that indicates whether the update succeeded and contains the updated WorkflowRuntimeModel when it did.
public virtual Task<bool> MultiServerRuntimesExistAsync() #Determines whether persistence contains a multi-server WorkflowRuntime record whose status is neither RuntimeStatus.Dead nor RuntimeStatus.Terminated.
public virtual Task<int> 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
currentRuntimeIdStringThe runtime identifier to exclude from the count.
Returns
Type
Description
Task<Int32>The number of other active multi-server WorkflowRuntime records.
public virtual Task<WorkflowRuntimeModel> GetWorkflowRuntimeModelAsync(string runtimeId) #Gets the persisted operational model for a WorkflowRuntime.
Parameters
Name
Type
Description
runtimeIdStringThe runtime identifier.
Returns
Type
Description
Task<WorkflowRuntimeModel>The persisted WorkflowRuntimeModel, or null when no matching runtime record exists.
public virtual Task InitializeProcessAsync(ProcessInstance processInstance) #Creates the persisted process instance record for a ProcessInstance.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance to persist.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ProcessAlreadyExistsExceptionA 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
processInstanceProcessInstanceThe ProcessInstance whose ProcessInstance.ProcessScheme has changed.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ProcessNotFoundExceptionNo 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
processInstanceProcessInstanceThe ProcessInstance to populate.
Returns
Type
Description
TaskA 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
processInstanceProcessInstanceThe ProcessInstance to populate.
Returns
Type
Description
TaskA 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
processInstanceProcessInstanceThe ProcessInstance to populate.
parameterNameStringThe parameter name.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task FillSystemProcessParametersAsync(ProcessInstance processInstance) #Loads ParameterPurpose.System process parameters into a ProcessInstance.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance to populate.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task SavePersistenceParametersAsync(ProcessInstance processInstance) #Saves changed process parameters whose purpose is ParameterPurpose.Persistence.
public virtual Task SavePersistenceParameterAsync(ProcessInstance processInstance, string parameterName) #Saves one modified process parameter whose purpose is ParameterPurpose.Persistence.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose parameter is saved.
parameterNameStringThe parameter name.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
public virtual Task RemoveParameterAsync(ProcessInstance processInstance, string parameterName) #Deletes the persisted value of a named process parameter.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose parameter value is deleted.
parameterNameStringThe parameter name.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task SetProcessStatusAsync(Guid processId, ProcessStatus newStatus) #Sets the ProcessStatus of a ProcessInstance.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
newStatusProcessStatusThe ProcessStatus to persist.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ImpossibleToSetStatusExceptionThe ProcessStatus cannot be changed.
public virtual Task SetWorkflowInitializedAsync(ProcessInstance processInstance) #Sets the process instance status to ProcessStatus.Initialized.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose status is set.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ImpossibleToSetStatusExceptionThe ProcessStatus cannot be changed.
public virtual Task SetWorkflowIdledAsync(ProcessInstance processInstance) #Sets the process instance status to ProcessStatus.Idled.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose status is set.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ImpossibleToSetStatusExceptionThe ProcessStatus cannot be changed.
public virtual Task SetWorkflowRunningAsync(ProcessInstance processInstance) #Sets the process instance status to ProcessStatus.Running.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose status is set.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ImpossibleToSetStatusExceptionThe ProcessStatus cannot be changed.
public virtual Task SetWorkflowFinalizedAsync(ProcessInstance processInstance) #Sets the process instance status to ProcessStatus.Finalized.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose status is set.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ImpossibleToSetStatusExceptionThe ProcessStatus cannot be changed.
public virtual Task SetWorkflowTerminatedAsync(ProcessInstance processInstance) #Sets the process instance status to ProcessStatus.Terminated.
Parameters
Name
Type
Description
processInstanceProcessInstanceThe ProcessInstance whose status is set.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
ImpossibleToSetStatusExceptionThe 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
processInstanceProcessInstanceThe ProcessInstance whose initial record is written.
Returns
Type
Description
TaskA 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
processInstanceProcessInstanceThe ProcessInstance that completed the transition.
transitionTransitionDefinitionThe executed TransitionDefinition.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Remarks
State and transition history persistence are controlled independently by ActivityDefinition.DisablePersistState and ActivityDefinition.DisablePersistTransitionHistory.
public virtual Task<bool> IsProcessExistsAsync(Guid processId) #Determines whether a ProcessInstance exists in persistence.
public virtual Task<bool> IsProcessExistsAsync(Guid processId, string tenantId) #Determines whether a ProcessInstance exists in persistence for a tenant.
public virtual Task<ProcessStatus> GetInstanceStatusAsync(Guid processId) #Gets the ProcessStatus of a ProcessInstance.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
Returns
Type
Description
Task<ProcessStatus>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
processIdsGuid[]The process identifiers.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task SaveGlobalParameterAsync<T>(string type, string name, T value) #Saves a global parameter value that is not scoped to a tenant.
Parameters
Name
Type
Description
typeStringThe logical parameter type.
nameStringThe parameter name.
value{T}The parameter value.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task SaveTenantGlobalParameterAsync<T>(TenantGlobalParameterKey key, T value) #Saves a global parameter value in the tenant scope specified by a TenantGlobalParameterKey.
Parameters
Name
Type
Description
keyTenantGlobalParameterKeyThe TenantGlobalParameterKey. Its TenantGlobalParameterKey.Name is required.
value{T}The parameter value.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task<T> LoadGlobalParameterAsync<T>(string type, string name) #Loads a global parameter value that is not scoped to a tenant.
Parameters
Name
Type
Description
typeStringThe logical parameter type.
nameStringThe parameter name.
Returns
Type
Description
Task<T>The parameter value, or the default value of
T when no matching parameter exists.public virtual Task<T> LoadTenantGlobalParameterAsync<T>(TenantGlobalParameterKey key) #Loads a global parameter value from the tenant scope specified by a TenantGlobalParameterKey.
Parameters
Name
Type
Description
keyTenantGlobalParameterKeyThe TenantGlobalParameterKey. Its TenantGlobalParameterKey.Name is required.
Returns
Type
Description
Task<T>The parameter value, or the default value of
T when no matching parameter exists.public Task<Dictionary<string, T>> LoadGlobalParametersWithNamesAsync<T>(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
typeStringThe logical parameter type.
sortSortingThe optional Sorting settings.
Returns
Type
Description
Task<String, T>A mapping from parameter names to values.
public Task<Dictionary<string, T>> LoadTenantGlobalParametersWithNamesAsync<T>(TenantGlobalParameterScope scope, Sorting sort = null) #Loads global parameter names and values from a TenantGlobalParameterScope.
Parameters
Name
Type
Description
scopeTenantGlobalParameterScopeThe TenantGlobalParameterScope to load.
sortSortingThe optional Sorting settings.
Returns
Type
Description
Task<String, T>A mapping from parameter names to values.
public virtual Task<List<T>> LoadGlobalParametersAsync<T>(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
typeStringThe logical parameter type.
sortSortingThe optional Sorting settings.
Returns
Type
Description
Task<List<T>>The parameter values.
public virtual Task<List<T>> LoadTenantGlobalParametersAsync<T>(TenantGlobalParameterScope scope, Sorting sort = null) #Loads global parameter values from a TenantGlobalParameterScope.
Parameters
Name
Type
Description
scopeTenantGlobalParameterScopeThe TenantGlobalParameterScope to load.
sortSortingThe optional Sorting settings.
Returns
Type
Description
Task<List<T>>The parameter values.
public virtual Task<PagedResponse<T>> LoadGlobalParametersWithPagingAsync<T>(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
typeStringThe logical parameter type.
pagingPagingThe Paging settings.
nameStringThe optional parameter-name filter.
sortSortingThe optional Sorting settings.
Returns
Type
Description
Task<PagedResponse<T>>A PagedResponse<T> containing the selected parameter values and total matching count.
public virtual Task<PagedResponse<T>> LoadTenantGlobalParametersWithPagingAsync<T>(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
scopeTenantGlobalParameterScopeThe TenantGlobalParameterScope to load.
pagingPagingThe Paging settings.
sortSortingThe optional Sorting settings.
Returns
Type
Description
Task<PagedResponse<T>>A PagedResponse<T> 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.
public virtual Task DeleteTenantGlobalParametersAsync(TenantGlobalParameterScope scope) #Deletes all global parameters in a TenantGlobalParameterScope.
Parameters
Name
Type
Description
scopeTenantGlobalParameterScopeThe TenantGlobalParameterScope to delete.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task DeleteTenantGlobalParameterAsync(TenantGlobalParameterKey key) #Deletes one global parameter identified by a TenantGlobalParameterKey.
Parameters
Name
Type
Description
keyTenantGlobalParameterKeyThe TenantGlobalParameterKey to delete.
Returns
Type
Description
TaskA 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
processIdGuidThe process identifier.
Returns
Type
Description
TaskA 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
processIdGuidThe identifier of the ProcessInstance that owns the timer.
rootProcessIdGuidThe identifier of the root process in the owning process tree.
nameStringThe timer name.
nextExecutionDateTimeDateTimeThe date and time when the timer becomes due.
tenantIdStringThe tenant identifier, if any.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task ClearTimersAsync(Guid processId, List<string> timersIgnoreList) #Deletes all persisted timer registrations for a ProcessInstance except timers whose names are retained.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
timersIgnoreListList<String>The timer names to retain.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task<int> SetTimerIgnoreAsync(Guid timerId) #Marks a persisted timer registration as ignored so it is not selected for execution.
Parameters
Name
Type
Description
timerIdGuidReturns
Type
Description
Task<Int32>The number of timer records changed.
public virtual Task<List<WorkflowTimer>> GetTopTimersToExecuteAsync(int top) #Gets a limited set of due timer registrations that have not been marked as ignored.
Parameters
Name
Type
Description
topInt32The maximum number of timer registrations to return.
Returns
Type
Description
Task<WorkflowTimer>The due WorkflowTimer objects in execution-time order.
Exceptions
Type
Description
ArgumentExceptiontop is not greater than zero.public virtual Task<List<ProcessHistoryItem>> GetProcessHistoryAsync(Guid processId, Paging paging = null) #Gets persisted transition history for a ProcessInstance.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
pagingPagingThe optional Paging settings.
Returns
Type
Description
Task<ProcessHistoryItem>The persisted ProcessHistoryItem records.
public Task<int> GetProcessHistoryCountAsync(Guid processId) #Gets the number of persisted transition history records for a ProcessInstance.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
Returns
Type
Description
Task<Int32>The number of persisted transition history records.
public virtual Task<List<ProcessTimer>> GetTimersForProcessAsync(Guid processId) #Gets all persisted timer registrations for a ProcessInstance.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
Returns
Type
Description
Task<ProcessTimer>The ProcessTimer objects registered for the ProcessInstance.
public virtual Task<List<IProcessInstanceTreeItem>> GetProcessInstanceTreeAsync(Guid rootProcessId) #Gets the persisted process instance tree for a root process.
Parameters
Name
Type
Description
rootProcessIdGuidThe root process identifier.
Returns
Type
Description
Task<IProcessInstanceTreeItem>The IProcessInstanceTreeItem records in the process instance tree.
public virtual Task<List<ProcessTimer>> GetActiveTimersForProcessAsync(Guid processId) #Gets the timer registrations for a ProcessInstance that have not been marked as ignored.
Parameters
Name
Type
Description
processIdGuidThe process identifier.
Returns
Type
Description
Task<ProcessTimer>The active ProcessTimer objects registered for the ProcessInstance.
public virtual Task<int> SendRuntimeLastAliveSignalAsync() #Updates WorkflowRuntimeModel.LastAliveSignal for the current WorkflowRuntime when its status is RuntimeStatus.Alive or RuntimeStatus.SelfRestore.
Returns
Type
Description
Task<Int32>The number of runtime records changed.
public virtual Task<DateTime?> GetNextTimerDateAsync(TimerCategory timerCategory, int timerInterval) #Attempts to reserve the next timer polling time for a TimerCategory in multi-server mode.
Parameters
Name
Type
Description
timerCategoryTimerCategoryThe TimerCategory.Timer or TimerCategory.ServiceTimer category whose polling time is reserved.
timerIntervalInt32The interval, in milliseconds, between polling times.
Returns
Type
Description
Task<DateTime>The reserved polling date and time, or null when another WorkflowRuntime changed the coordination lock first.
public virtual Task<List<WorkflowRuntimeModel>> GetWorkflowRuntimesAsync() #Gets all persisted WorkflowRuntimeModel records.
Returns
Type
Description
Task<WorkflowRuntimeModel>The persisted WorkflowRuntimeModel objects.
public virtual Task<SchemeDefinition<XElement>> GetProcessSchemeByProcessIdAsync(Guid processId) #Gets the stored built scheme version assigned to a process instance.
Parameters
Name
Type
Description
processIdGuidThe identifier of the process instance whose assigned scheme is retrieved.
Returns
Type
Description
Task<XElement>The SchemeDefinition<T> assigned to the process instance.
Exceptions
Type
Description
ProcessNotFoundExceptionThrown when no process instance exists with
processId.SchemeNotFoundExceptionThrown when the process instance has no assigned scheme or its stored built scheme version cannot be found.
public virtual Task<SchemeDefinition<XElement>> GetProcessSchemeBySchemeIdAsync(Guid schemeId) #Gets a stored built scheme version by its scheme ID.
Parameters
Name
Type
Description
schemeIdGuidThe scheme ID of the stored built scheme version.
Returns
Type
Description
Task<XElement>The requested SchemeDefinition<T>.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when no stored built scheme version exists with
schemeId.public virtual Task<SchemeDefinition<XElement>> 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
schemeCodeStringThe code of the stored built scheme version to retrieve.
rootSchemeIdNullable<Guid>The root scheme ID for a subprocess scheme, or null to select versions without a root scheme.
ignoreObsoleteBooleantenantIdStringThe tenant identifier that defines the exact search scope, or null to search shared schemes.
Returns
Type
Description
Task<XElement>The matching SchemeDefinition<T>.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when no stored built scheme version matches the supplied criteria.
[Obsolete("Use SetSchemeIsObsoleteAsync(string schemeCode) instead.")] public virtual Task SetSchemeIsObsoleteAsync(string schemeCode, IDictionary<string, object> parameters) Obsolete #Parameters
Name
Type
Description
schemeCodeStringparametersIDictionary<String, Object>Returns
Type
Description
Taskpublic virtual Task SetSchemeIsObsoleteAsync(string schemeCode, string tenantId = null) #Marks stored built scheme versions associated with a scheme code as obsolete.
public virtual Task<SchemeDefinition<XElement>> SaveSchemeAsync(SchemeDefinition<XElement> scheme) #Stores a built scheme version if no matching version is already persisted.
Parameters
Name
Type
Description
schemeSchemeDefinition<XElement>The SchemeDefinition<T> containing the built scheme and stored-version metadata to persist.
Returns
Type
Description
Task<XElement>The stored SchemeDefinition<T>, either newly inserted or an existing matching version.
public virtual Task UpsertSchemeAsync(SchemeDefinition<XElement> scheme) #Inserts or updates a stored built scheme version.
Parameters
Name
Type
Description
schemeSchemeDefinition<XElement>The SchemeDefinition<T> containing the built scheme and stored-version metadata to insert or update.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task SaveSchemeAsync(string schemaCode, bool canBeInlined, List<string> inlinedSchemes, string scheme, List<string> tags, string tenantId = null) #Saves an unparsed source scheme together with its Scheme Inlining relationships and tags.
Parameters
Name
Type
Description
schemaCodeStringinlinedSchemesList<String>The codes of the inlinable schemes referenced by this scheme.
schemeStringThe serialized unparsed source scheme.
tagsList<String>The scheme tags to store.
tenantIdStringThe tenant identifier that defines the exact storage scope, or null for a shared scheme.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
public virtual Task<XElement> GetSchemeAsync(string code, string tenantId = null) #Gets the unparsed source scheme identified by a scheme code.
Parameters
Name
Type
Description
codeStringThe code of the source scheme to retrieve.
tenantIdStringThe tenant identifier used to prefer a tenant-specific scheme over a shared scheme, or null to search only shared schemes.
Returns
Type
Description
Task<XElement>The unparsed source scheme represented by XElement.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when no source scheme with
code is available in the requested scope.public virtual Task<List<string>> GetInlinedSchemeCodesAsync(string tenantId = null) #Gets the distinct codes of schemes available for use as inlinable schemes.
Parameters
Name
Type
Description
tenantIdStringThe tenant identifier. When specified, the result includes shared schemes and schemes in that tenant scope; when null, the result includes only shared schemes.
Returns
Type
Description
Task<String>The distinct inlinable scheme codes.
public virtual Task<List<string>> SearchSchemesByTagsAsync(params string[] tags) #Gets the codes of shared schemes that match at least one specified tag.
Parameters
Name
Type
Description
Returns
Type
Description
Task<String>The matching shared scheme codes.
public virtual Task<List<string>> SearchSchemesByTagsAsync(IEnumerable<string> tags) #Gets the codes of shared schemes that match at least one specified tag.
Parameters
Name
Type
Description
tagsIEnumerable<String>The tags to match, or null to return all shared scheme codes. An empty collection also returns all shared scheme codes.
Returns
Type
Description
Task<String>The matching shared scheme codes.
public virtual Task<List<string>> SearchSchemesByTagsAsync(string tenantId, IEnumerable<string> tags) #Gets the codes of schemes in an exact tenant scope that match at least one specified tag.
Parameters
Name
Type
Description
tenantIdStringThe tenant identifier that defines the exact search scope, or null to search shared schemes.
tagsIEnumerable<String>The tags to match, or 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<String>The matching scheme codes in the selected scope.
public virtual Task<List<string>> 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
tenantIdStringThe tenant identifier that defines the exact search scope.
tagsString[]The tags to match. If the array is null or empty, every scheme code in the tenant scope is returned.
Returns
Type
Description
Task<String>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
schemeCodeStringThe code of the shared source scheme.
tagsString[]The scheme tags to add.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when the shared source scheme identified by
schemeCode does not exist.public virtual Task AddSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #Adds tags to a source scheme in the shared scope.
Parameters
Name
Type
Description
schemeCodeStringThe code of the shared source scheme.
tagsIEnumerable<String>The scheme tags to add.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when the shared source scheme identified by
schemeCode does not exist.public virtual Task AddSchemeTagsAsync(string schemeCode, string tenantId, IEnumerable<string> tags) #Adds tags to a source scheme in an exact tenant scope.
Parameters
Name
Type
Description
schemeCodeStringThe source scheme code.
tagsIEnumerable<String>The scheme tags to add.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown 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
schemeCodeStringThe source scheme code.
tenantIdStringThe tenant identifier that defines the exact scope.
tagsString[]The scheme tags to add.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown 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
schemeCodeStringThe code of the shared source scheme.
tagsString[]The scheme tags to remove.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when the shared source scheme identified by
schemeCode does not exist.public virtual Task RemoveSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #Removes tags from a source scheme in the shared scope.
Parameters
Name
Type
Description
schemeCodeStringThe code of the shared source scheme.
tagsIEnumerable<String>The scheme tags to remove.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when the shared source scheme identified by
schemeCode does not exist.public virtual Task RemoveSchemeTagsAsync(string schemeCode, string tenantId, IEnumerable<string> tags) #Removes tags from a source scheme in an exact tenant scope.
Parameters
Name
Type
Description
schemeCodeStringThe source scheme code.
tagsIEnumerable<String>The scheme tags to remove.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown 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
schemeCodeStringThe source scheme code.
tenantIdStringThe tenant identifier that defines the exact scope.
tagsString[]The scheme tags to remove.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown 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
schemeCodeStringThe code of the shared source scheme.
tagsString[]The replacement scheme tags; an empty array removes all tags.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when the shared source scheme identified by
schemeCode does not exist.public virtual Task SetSchemeTagsAsync(string schemeCode, IEnumerable<string> tags) #Replaces all tags on a source scheme in the shared scope.
Parameters
Name
Type
Description
schemeCodeStringThe code of the shared source scheme.
tagsIEnumerable<String>The replacement scheme tags; an empty collection removes all tags.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when the shared source scheme identified by
schemeCode does not exist.public virtual Task SetSchemeTagsAsync(string schemeCode, string tenantId, IEnumerable<string> tags) #Replaces all tags on a source scheme in an exact tenant scope.
Parameters
Name
Type
Description
schemeCodeStringThe source scheme code.
tagsIEnumerable<String>The replacement scheme tags; an empty collection removes all tags.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown 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
schemeCodeStringThe source scheme code.
tenantIdStringThe tenant identifier that defines the exact scope.
tagsString[]The replacement scheme tags; an empty array removes all tags.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Exceptions
Type
Description
SchemeNotFoundExceptionThrown when no source scheme with
schemeCode exists in the scope selected by tenantId.public virtual Task<XElement> 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
schemeCodeStringThe code of the process scheme to generate.
tenantIdStringThe tenant identifier that scopes generation, or null for generation without a tenant scope.
Returns
Type
Description
Task<XElement>A Task<TResult> whose result is the generated source process scheme.
public void AddMapping(string processName, object generatorSource) #Parameters
Name
Type
Description
processNameStringgeneratorSourceObjectpublic virtual Task BulkInitProcessesAsync(List<ProcessInstance> 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
instancesList<ProcessInstance>The ProcessInstance objects to persist.
statusProcessStatusThe ProcessStatus to assign to each ProcessInstance.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Remarks
Check IPersistenceProvider.IsBulkOperationsSupported before calling this method.
public virtual Task BulkInitProcessesAsync(List<ProcessInstance> instances, List<TimerToRegister> 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
instancesList<ProcessInstance>The ProcessInstance objects to persist.
timersList<TimerToRegister>The TimerToRegister objects to persist.
statusProcessStatusThe ProcessStatus to assign to each ProcessInstance.
Returns
Type
Description
TaskA Task that represents the asynchronous operation.
Remarks
Check IPersistenceProvider.IsBulkOperationsSupported before calling this method.
public Task DropWorkflowInboxAsync(Guid processId) #Removes all approval inbox entries associated with the specified process instance.
Parameters
Name
Type
Description
processIdGuidThe identifier of the process instance whose inbox entries are removed.
Returns
Type
Description
TaskA task that represents the asynchronous operation.
public Task InsertInboxAsync(List<InboxItem> newActors) #Adds approval inbox entries.
Parameters
Name
Type
Description
newActorsList<InboxItem>Returns
Type
Description
TaskA task that represents the asynchronous operation.
public Task<int> GetInboxCountByProcessIdAsync(Guid processId) #Gets the number of approval inbox entries associated with the specified process instance.
Parameters
Name
Type
Description
processIdGuidThe identifier of the process instance whose inbox entries are counted.
Returns
Type
Description
Task<Int32>A task whose result is the number of matching inbox entries.
public Task<int> GetInboxCountByIdentityIdAsync(string identityId) #Gets the number of approval inbox entries available to the specified workflow participant identity.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity whose inbox entries are counted.
Returns
Type
Description
Task<Int32>A task whose result is the number of matching inbox entries.
public Task<List<InboxItem>> GetInboxByProcessIdAsync(Guid processId, Paging paging = null, CultureInfo culture = null) #Gets approval inbox entries associated with the specified process instance.
Parameters
Name
Type
Description
processIdGuidThe identifier of the process instance whose inbox entries are retrieved.
pagingPagingThe optional Paging settings that select a page of results.
cultureCultureInfoThe CultureInfo used to localize the command names in InboxItem.AvailableCommands, or null to use CultureInfo.CurrentCulture.
Returns
Type
Description
Task<InboxItem>A task whose result contains the matching InboxItem objects.
public Task<List<InboxItem>> GetInboxByIdentityIdAsync(string identityId, Paging paging = null, CultureInfo culture = null) #Gets approval inbox entries available to the specified workflow participant identity.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity whose inbox entries are retrieved.
pagingPagingThe optional Paging settings that select a page of results.
cultureCultureInfoThe CultureInfo used to localize the command names in InboxItem.AvailableCommands, or null to use CultureInfo.CurrentCulture.
Returns
Type
Description
Task<InboxItem>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
approvalHistoryItemApprovalHistoryItemThe ApprovalHistoryItem containing the approval history data to add or apply.
Returns
Type
Description
TaskA 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
processIdGuidThe identifier of the process instance whose pending entries are removed.
Returns
Type
Description
TaskA 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
processIdGuidThe identifier of the process instance whose approval history is removed.
Returns
Type
Description
TaskA task that represents the asynchronous operation.
public Task DropApprovalHistoryByIdentityIdAsync(string identityId) #Removes approval history entries recorded for the specified executor.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity of the executor whose approval history entries are removed.
Returns
Type
Description
TaskA task that represents the asynchronous operation.
public Task<int> GetApprovalHistoryCountByProcessIdAsync(Guid processId) #Gets the number of approval history entries associated with the specified process instance.
Parameters
Name
Type
Description
processIdGuidThe identifier of the process instance whose approval history entries are counted.
Returns
Type
Description
Task<Int32>A task whose result is the number of matching approval history entries.
public Task<int> GetApprovalHistoryCountByIdentityIdAsync(string identityId) #Gets the number of approval history entries recorded for the specified executor.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity of the executor whose approval history entries are counted.
Returns
Type
Description
Task<Int32>A task whose result is the number of matching approval history entries.
public Task<List<ApprovalHistoryItem>> GetApprovalHistoryByProcessIdAsync(Guid processId, Paging paging = null) #Gets approval history entries associated with the specified process instance.
Parameters
Name
Type
Description
processIdGuidThe identifier of the process instance whose approval history is retrieved.
pagingPagingThe optional Paging settings that select a page of results.
Returns
Type
Description
Task<ApprovalHistoryItem>A task whose result contains the matching ApprovalHistoryItem objects.
public Task<List<ApprovalHistoryItem>> GetApprovalHistoryByIdentityIdAsync(string identityId, Paging paging = null) #Gets approval history entries recorded for the specified executor.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity of the executor whose approval history is retrieved.
pagingPagingThe optional Paging settings that select a page of results.
Returns
Type
Description
Task<ApprovalHistoryItem>A task whose result contains the matching ApprovalHistoryItem objects.
public Task<int> GetOutboxCountByIdentityIdAsync(string identityId) #Gets the number of process-specific OutboxItem summaries for the specified executor.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity of the executor whose approval history is summarized.
Returns
Type
Description
Task<Int32>A task whose result is the number of process-specific approval summaries.
public Task<List<OutboxItem>> GetOutboxByIdentityIdAsync(string identityId, Paging paging = null) #Gets process-specific OutboxItem summaries of approvals performed by the specified executor.
Parameters
Name
Type
Description
identityIdStringThe workflow participant identity of the executor whose approval history is summarized.
pagingPagingThe optional Paging settings that select a page of results.
Returns
Type
Description
Task<OutboxItem>A task whose result contains the matching OutboxItem objects.
public Task<WorkflowForm> GetFormAsync(string name, int? version = null, string tenantId = null) #Gets a form by name and optional version.
Parameters
Name
Type
Description
nameStringThe form name.
tenantIdStringThe tenant identifier, or 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<WorkflowForm>A Task<TResult> whose result contains the matching WorkflowForm, or null when no matching form is found.
public Task<List<string>> GetFormNamesAsync(string tenantId = null) #Gets the distinct form names available in the selected scope.
Parameters
Name
Type
Description
tenantIdStringThe tenant identifier, or null to read from the shared scope. When specified, the result combines names from the tenant and shared scopes.
Returns
Type
Description
Task<String>A Task<TResult> whose result contains the distinct form names available in the selected scope.
public Task<List<int>> GetFormVersionsAsync(string name, string tenantId = null) #Gets the distinct versions of a form available in the selected scope.
Parameters
Name
Type
Description
nameStringThe form name.
tenantIdStringThe tenant identifier, or 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<Int32>A Task<TResult> whose result contains the distinct form version numbers available in the selected scope.
public Task<WorkflowForm> 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
nameStringThe form name.
defaultDefinitionStringThe form definition to use when
version is null and no source form is available in the target scope or, when initializing a tenant scope, the shared scope.versionNullable<Int32>The source form version whose definition is copied, or 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.
tenantIdStringThe tenant identifier, or 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<WorkflowForm>A Task<TResult> whose result contains the newly created WorkflowForm.
public Task<WorkflowForm> 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
nameStringThe form name.
defaultDefinitionStringThe definition to use for a newly created form when no shared form is available as a source.
tenantIdStringThe tenant identifier, or null to use the shared scope. A new tenant-scoped form uses the shared form definition when one is available.
Returns
Type
Description
Task<WorkflowForm>A Task<TResult> whose result contains the existing or newly created WorkflowForm.
public Task<int> 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
nameStringThe form name.
versionInt32The form version to update.
lockValueInt32The expected current lock value for optimistic concurrency.
definitionStringThe new form definition.
tenantIdStringThe tenant identifier, or null to update the shared scope. The update is limited to the selected scope.
Returns
Type
Description
Task<Int32>A Task<TResult> 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.
public Task DeleteFormAsync(string name, string tenantId = null) #Deletes all versions of a form from the selected scope.