Class AutomationTaskStore
SQL Server implementation of the automation task store, providing persistence and retrieval operations for automation tasks. Handles serialization/deserialization of task settings from JSON, manages filters, and coordinates database queries.
Implements
Inherited Members
Namespace: DataWeb.Automation.SqlServer
Assembly: DataWeb.Data.SqlServer.dll
Syntax
public class AutomationTaskStore : IAutomationTaskStore
Constructors
AutomationTaskStore(ISqlHelper)
SQL Server implementation of the automation task store, providing persistence and retrieval operations for automation tasks. Handles serialization/deserialization of task settings from JSON, manages filters, and coordinates database queries.
Declaration
public AutomationTaskStore(ISqlHelper sqlHelper)
Parameters
| Type | Name | Description |
|---|---|---|
| ISqlHelper | sqlHelper | An instance of ISqlHelper used to execute database queries and retrieve records. |
Properties
Name
Gets the name of the store implementation.
Declaration
public string Name { get; }
Property Value
| Type | Description |
|---|---|
| string | Returns "SqlServer" to identify this as the SQL Server store implementation. |
Methods
GetTaskAsync(AutomationTaskFilter, CancellationToken)
Asynchronously retrieves the first automation task matching the specified filter criteria.
Declaration
public Task<AutomationTaskData> GetTaskAsync(AutomationTaskFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationTaskFilter | filter | The AutomationTaskFilter criteria used to query the automation task. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<AutomationTaskData> | A task that represents the asynchronous operation. The task result contains the first matching AutomationTaskData, or null if no match is found. |
GetTasksAsync(AutomationTaskFilter, CancellationToken)
Asynchronously retrieves a collection of automation tasks matching the specified filter criteria. Executes database query, deserializes JSON settings (trigger, execution, sandbox, schedule), and returns populated task data.
Declaration
public Task<IEnumerable<AutomationTaskData>> GetTasksAsync(AutomationTaskFilter filter, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AutomationTaskFilter | filter | The AutomationTaskFilter criteria containing IdMaster, ScenarioIdMaster, Name, Count, and PublishMode filters. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<AutomationTaskData>> | A task that represents the asynchronous operation. The task result contains an enumerable collection of AutomationTaskData with fully deserialized settings and parameters. |
SetExecutionEndDateAsync(string, DateTimeOffset?, CancellationToken)
Asynchronously updates the execution end date of the specified automation task in the database.
Declaration
public Task SetExecutionEndDateAsync(string taskIdMaster, DateTimeOffset? date, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | taskIdMaster | The unique master identifier of the task to update. |
| DateTimeOffset? | date | The execution end date to set. Pass null to clear the existing value. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation of updating the execution end date. |
SetExecutionStartDateAsync(string, DateTimeOffset?, CancellationToken)
Asynchronously updates the execution start date of the specified automation task in the database.
Declaration
public Task SetExecutionStartDateAsync(string taskIdMaster, DateTimeOffset? date, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | taskIdMaster | The unique master identifier of the task to update. |
| DateTimeOffset? | date | The execution start date to set. Pass null to clear the existing value. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation of updating the execution start date. |
SetStatusAsync(string, AutomationTaskStatus, CancellationToken)
Asynchronously updates the execution status of the specified automation task in the database.
Declaration
public Task SetStatusAsync(string taskIdMaster, AutomationTaskStatus status, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | taskIdMaster | The unique master identifier of the task to update. |
| AutomationTaskStatus | status | The new AutomationTaskStatus value to set for the task. |
| CancellationToken | cancellationToken | A token to monitor for cancellation requests. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation of updating the task status. |