Table of Contents

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

dependencies ModificationCommandBatchFactoryDependencies

Service dependencies.

maxBatchSize int?

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

reader RelationalDataReader

The data reader.

ConsumeAsync(RelationalDataReader, CancellationToken)

Consumes the data reader created by ExecuteAsync(IRelationalConnection, CancellationToken).

protected override Task ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken = default)

Parameters

reader RelationalDataReader

The data reader.

cancellationToken CancellationToken

A 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

startCommandIndex int

The ordinal of the first command being consumed.

reader RelationalDataReader

The 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

startCommandIndex int

The ordinal of the first result set being consumed.

reader RelationalDataReader

The data reader.

cancellationToken CancellationToken

A 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

commandIndex int

The ordinal of the command being consumed.

reader RelationalDataReader

The 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

commandIndex int

The ordinal of the command being consumed.

reader RelationalDataReader

The data reader.

cancellationToken CancellationToken

A 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

reader RelationalDataReader

The data reader.

commandIndex int

The ordinal of the command.

expectedRowsAffected int

The expected number of rows affected.

rowsAffected int

The 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

reader RelationalDataReader

The data reader.

commandIndex int

The ordinal of the command.

expectedRowsAffected int

The expected number of rows affected.

rowsAffected int

The actual number of rows affected.

cancellationToken CancellationToken

A 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.