Interface IBatchManager
Provides an interface for batch managers.
Namespace: Paradigm.ORM.Data.Batching
Assembly: Paradigm.ORM.Data.dll
Syntax
public interface IBatchManager : IDisposable
Remarks
The function of a batch manager is to manage secuential batches that may require actions inbetween. For example when saving a list of entities, if the entities have children, we need to execute the first batch of parents, then extract the ids, set the ids on children, and then execute the second batch for the children.
Properties
| Improve this Doc View SourceMaxCount
Gets or sets the maximum count of command steps per batch.
Declaration
int MaxCount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceAdd(ICommandBatchStep)
Adds the specified command to the current batch.
Declaration
IBatchManager Add(ICommandBatchStep command)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandBatchStep | command | The command. |
Returns
| Type | Description |
|---|---|
| IBatchManager | Returns the batch manager instance. |
AddNewBatch()
Adds a new batch to the manager.
Declaration
IBatchManager AddNewBatch()
Returns
| Type | Description |
|---|---|
| IBatchManager | Returns the batch manager instance. |
Remarks
The batch manager can handle several batches. When adding commands to manager, the manager will add the command to the current active batch manager as new batch step.
AddNewBatch(Action)
Adds a new batch to the manager.
Declaration
IBatchManager AddNewBatch(Action action)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | action | The action. |
Returns
| Type | Description |
|---|---|
| IBatchManager | Returns the batch manager instance. |
Remarks
The batch manager can handle several sequential batches. When adding commands to manager, the manager will add the command to the current active batch as a new batch step.
AddNewBatch(Func<Task>)
Adds a new batch to the manager.
Declaration
IBatchManager AddNewBatch(Func<Task> action)
Parameters
| Type | Name | Description |
|---|---|---|
| Func<Task> | action | The action. |
Returns
| Type | Description |
|---|---|
| IBatchManager | Returns the batch manager instance. |
Remarks
The batch manager can handle several sequential batches. When adding commands to manager, the manager will add the command to the current active batch as a new batch step.
Execute()
Executes all the batch steps.
Declaration
void Execute()
ExecuteAsync()
Executes all the batch steps.
Declaration
Task ExecuteAsync()
Returns
| Type | Description |
|---|---|
| Task |
Reset()
Resets the batch manager. All the steps and command will be cleared.
Declaration
void Reset()