Class AffectedCountModificationCommandBatch
- Namespace
- Microsoft.EntityFrameworkCore.Update
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A ReaderModificationCommandBatch for providers which return values to find out how many rows were affected.
This type is typically used by database providers; it is generally not used in application code.
public abstract class AffectedCountModificationCommandBatch : ReaderModificationCommandBatch
- Inheritance
-
AffectedCountModificationCommandBatch
- Derived
- Inherited Members
Remarks
See Implementation of database providers and extensions for more information and examples.
Constructors
AffectedCountModificationCommandBatch(ModificationCommandBatchFactoryDependencies, int?)
Creates a new AffectedCountModificationCommandBatch instance.
protected AffectedCountModificationCommandBatch(ModificationCommandBatchFactoryDependencies dependencies, int? maxBatchSize = null)
Parameters
dependenciesModificationCommandBatchFactoryDependenciesService dependencies.
maxBatchSizeint?The maximum batch size. Defaults to 1000.
Methods
Consume(RelationalDataReader)
Consumes the data reader created by Execute(IRelationalConnection).
protected override void Consume(RelationalDataReader reader)
Parameters
readerRelationalDataReaderThe data reader.
ConsumeAsync(RelationalDataReader, CancellationToken)
Consumes the data reader created by ExecuteAsync(IRelationalConnection, CancellationToken).
protected override Task ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken = default)
Parameters
readerRelationalDataReaderThe data reader.
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
ConsumeResultSet(int, RelationalDataReader)
Consumes the data reader created by Execute(IRelationalConnection), propagating values back into the ModificationCommand.
protected virtual int ConsumeResultSet(int startCommandIndex, RelationalDataReader reader)
Parameters
startCommandIndexintThe ordinal of the first command being consumed.
readerRelationalDataReaderThe data reader.
Returns
- int
The ordinal of the next result set that must be consumed.
ConsumeResultSetAsync(int, RelationalDataReader, CancellationToken)
Consumes the data reader created by ExecuteAsync(IRelationalConnection, CancellationToken), propagating values back into the ModificationCommand.
protected virtual Task<int> ConsumeResultSetAsync(int startCommandIndex, RelationalDataReader reader, CancellationToken cancellationToken)
Parameters
startCommandIndexintThe ordinal of the first result set being consumed.
readerRelationalDataReaderThe data reader.
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task<int>
A task that represents the asynchronous operation. The task contains the ordinal of the next command that must be consumed.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
ConsumeResultSetWithRowsAffectedOnly(int, RelationalDataReader)
Consumes the data reader created by Execute(IRelationalConnection) without propagating values back into the ModificationCommand.
protected virtual int ConsumeResultSetWithRowsAffectedOnly(int commandIndex, RelationalDataReader reader)
Parameters
commandIndexintThe ordinal of the command being consumed.
readerRelationalDataReaderThe data reader.
Returns
- int
The ordinal of the next command that must be consumed.
ConsumeResultSetWithRowsAffectedOnlyAsync(int, RelationalDataReader, CancellationToken)
Consumes the data reader created by ExecuteAsync(IRelationalConnection, CancellationToken) without propagating values back into the ModificationCommand.
protected virtual Task<int> ConsumeResultSetWithRowsAffectedOnlyAsync(int commandIndex, RelationalDataReader reader, CancellationToken cancellationToken)
Parameters
commandIndexintThe ordinal of the command being consumed.
readerRelationalDataReaderThe data reader.
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task<int>
A task that represents the asynchronous operation. The task contains the ordinal of the next command that must be consumed.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.
ThrowAggregateUpdateConcurrencyException(RelationalDataReader, int, int, int)
Throws an exception indicating the command affected an unexpected number of rows.
protected virtual void ThrowAggregateUpdateConcurrencyException(RelationalDataReader reader, int commandIndex, int expectedRowsAffected, int rowsAffected)
Parameters
readerRelationalDataReaderThe data reader.
commandIndexintThe ordinal of the command.
expectedRowsAffectedintThe expected number of rows affected.
rowsAffectedintThe actual number of rows affected.
ThrowAggregateUpdateConcurrencyExceptionAsync(RelationalDataReader, int, int, int, CancellationToken)
Throws an exception indicating the command affected an unexpected number of rows.
protected virtual Task ThrowAggregateUpdateConcurrencyExceptionAsync(RelationalDataReader reader, int commandIndex, int expectedRowsAffected, int rowsAffected, CancellationToken cancellationToken)
Parameters
readerRelationalDataReaderThe data reader.
commandIndexintThe ordinal of the command.
expectedRowsAffectedintThe expected number of rows affected.
rowsAffectedintThe actual number of rows affected.
cancellationTokenCancellationTokenA CancellationToken to observe while waiting for the task to complete.
Returns
- Task
A task that represents the asynchronous operation.
Exceptions
- OperationCanceledException
If the CancellationToken is canceled.