Table of Contents

Interface IBatchExecutor

Namespace
Microsoft.EntityFrameworkCore.Update
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

A service for executing one or more batches of insert/update/delete commands against a database.

This type is typically used by database providers; it is generally not used in application code.

The service lifetime is Scoped. This means that each Microsoft.EntityFrameworkCore.DbContext instance will use its own instance of this service. The implementation may depend on other services registered with any lifetime. The implementation does not need to be thread-safe.

public interface IBatchExecutor

Methods

Execute(IEnumerable<ModificationCommandBatch>, IRelationalConnection)

Executes the commands in the batches against the given database connection.

int Execute(IEnumerable<ModificationCommandBatch> commandBatches, IRelationalConnection connection)

Parameters

commandBatches IEnumerable<ModificationCommandBatch>

The batches to execute.

connection IRelationalConnection

The database connection to use.

Returns

int

The total number of rows affected.

ExecuteAsync(IEnumerable<ModificationCommandBatch>, IRelationalConnection, CancellationToken)

Executes the commands in the batches against the given database connection.

Task<int> ExecuteAsync(IEnumerable<ModificationCommandBatch> commandBatches, IRelationalConnection connection, CancellationToken cancellationToken = default)

Parameters

commandBatches IEnumerable<ModificationCommandBatch>

The batches to execute.

connection IRelationalConnection

The database connection to use.

cancellationToken CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<int>

A task that represents the asynchronous save operation. The task result contains the total number of rows affected.