Class ModificationCommandBatch
- Namespace
- Microsoft.EntityFrameworkCore.Update
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A base class for a collection of ModificationCommands that can be executed as a batch.
This type is typically used by database providers; it is generally not used in application code.
public abstract class ModificationCommandBatch
- Inheritance
-
ModificationCommandBatch
- Derived
- Inherited Members
Remarks
See Implementation of database providers and extensions for more information and examples.
Constructors
ModificationCommandBatch()
protected ModificationCommandBatch()
Properties
AreMoreBatchesExpected
Indicates whether more batches are expected after this one.
public abstract bool AreMoreBatchesExpected { get; }
Property Value
ModificationCommands
The list of conceptual insert/update/delete ModificationCommandss in the batch.
public abstract IReadOnlyList<IReadOnlyModificationCommand> ModificationCommands { get; }
Property Value
RequiresTransaction
Indicates whether the batch requires a transaction in order to execute correctly.
public abstract bool RequiresTransaction { get; }
Property Value
Methods
Complete(bool)
Indicates that no more commands will be added to this batch, and prepares it for execution.
public abstract void Complete(bool moreBatchesExpected)
Parameters
moreBatchesExpectedbool
Execute(IRelationalConnection)
Sends insert/update/delete commands to the database.
public abstract void Execute(IRelationalConnection connection)
Parameters
connectionIRelationalConnectionThe database connection to use.
ExecuteAsync(IRelationalConnection, CancellationToken)
Sends insert/update/delete commands to the database.
public abstract Task ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken = default)
Parameters
connectionIRelationalConnectionThe database connection to use.
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous save operation.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
TryAddCommand(IReadOnlyModificationCommand)
Attempts to adds the given insert/update/delete modificationCommand to the batch.
public abstract bool TryAddCommand(IReadOnlyModificationCommand modificationCommand)
Parameters
modificationCommandIReadOnlyModificationCommandThe command to add.