Table of Contents

Interface IMigrationCommandExecutor

Namespace
Microsoft.EntityFrameworkCore.Migrations
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

A service for executing migration commands against a database.

The service lifetime is Singleton. This means a single instance is used by many Microsoft.EntityFrameworkCore.DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

public interface IMigrationCommandExecutor

Methods

ExecuteNonQuery(IEnumerable<MigrationCommand>, IRelationalConnection)

Executes the given commands using the given database connection.

void ExecuteNonQuery(IEnumerable<MigrationCommand> migrationCommands, IRelationalConnection connection)

Parameters

migrationCommands IEnumerable<MigrationCommand>

The commands to execute.

connection IRelationalConnection

The connection to use.

ExecuteNonQueryAsync(IEnumerable<MigrationCommand>, IRelationalConnection, CancellationToken)

Executes the given commands using the given database connection.

Task ExecuteNonQueryAsync(IEnumerable<MigrationCommand> migrationCommands, IRelationalConnection connection, CancellationToken cancellationToken = default)

Parameters

migrationCommands IEnumerable<MigrationCommand>

The commands to execute.

connection IRelationalConnection

The connection to use.

cancellationToken CancellationToken

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

Returns

Task

A task that represents the asynchronous operation.