IHistoryRepository Interface

Definition

An interface for the repository used to access the '__EFMigrationsHistory' table that tracks metadata about EF Core Migrations such as which migrations have been applied.

public interface IHistoryRepository
type IHistoryRepository = interface
Public Interface IHistoryRepository
Derived

Remarks

Database providers typically implement this service by inheriting from HistoryRepository.

The service lifetime is Scoped. This means that each 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.

See Database migrations for more information and examples.

Methods

Exists()

Checks whether or not the history table exists.

ExistsAsync(CancellationToken)

Checks whether or not the history table exists.

GetAppliedMigrations()

Queries the history table for all migrations that have been applied.

GetAppliedMigrationsAsync(CancellationToken)

Queries the history table for all migrations that have been applied.

GetBeginIfExistsScript(String)

Generates a SQL Script that will BEGIN a block of SQL if and only if the migration with the given identifier already exists in the history table.

GetBeginIfNotExistsScript(String)

Generates a SQL Script that will BEGIN a block of SQL if and only if the migration with the given identifier does not already exist in the history table.

GetCreateIfNotExistsScript()

Generates a SQL script that will create the history table if and only if it does not already exist.

GetCreateScript()

Generates a SQL script that will create the history table.

GetDeleteScript(String)

Generates a SQL script to delete a row from the history table.

GetEndIfScript()

Generates a SQL script to END the SQL block.

GetInsertScript(HistoryRow)

Generates a SQL script to insert a row into the history table.

Applies to