Microsoft.EntityFrameworkCore.Migrations Namespace

Classes

HistoryRepository

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

Database providers must inherit from this class to implement provider-specific functionality.

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.

HistoryRepositoryDependencies

Service dependencies parameter class for HistoryRepository

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

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.

HistoryRow

An entity type that represents a row in the Migrations history table.

Migration

A base class inherited by each EF Core migration.

MigrationAttribute

Indicates that a class is a Migration and provides its identifier.

MigrationBuilder

A builder providing a fluentish API for building MigrationOperations.

MigrationCommand

Represents a command ready to be sent to the database to migrate it.

MigrationCommandListBuilder

A builder for creating a list of MigrationCommands that can then be executed to migrate a database.

MigrationsAnnotationProvider

A base class inherited by database providers that gives access to annotations used by EF Core Migrations when generating removal operations for various elements of the IRelationalModel.

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

MigrationsAnnotationProviderDependencies

Service dependencies parameter class for MigrationsAnnotationProvider

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

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

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

MigrationsAssemblyExtensions

Extension methods for IMigrationsAssembly.

MigrationsSqlGenerator

Generates the SQL in MigrationCommand objects that can then be executed or scripted from a list of MigrationOperations.

This class is typically inherited by database providers to customize the SQL generation.

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.

MigrationsSqlGeneratorDependencies

Service dependencies parameter class for MigrationsSqlGenerator

This type is typically used by database providers (and other extensions). It is generally not used in application code.

Do not construct instances of this class directly from either provider or application code as the constructor signature may change as new dependencies are added. Instead, use this type in your constructor so that an instance will be created and injected automatically by the dependency injection container. To create an instance with some dependent services replaced, first resolve the object from the dependency injection container, then replace selected services using the 'With...' methods. Do not call the constructor at any point in this process.

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.

SqliteMigrationBuilderExtensions

SQLite specific extension methods for MigrationBuilder.

SqliteMigrationsAnnotationProvider
SqliteMigrationsSqlGenerator

SQLite-specific implementation of MigrationsSqlGenerator.

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.

SqlServerMigrationBuilderExtensions

SQL Server specific extension methods for MigrationBuilder.

SqlServerMigrationsSqlGenerator

SQL Server-specific implementation of MigrationsSqlGenerator.

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.

Interfaces

IHistoryRepository

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.

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.

IMigrationCommandExecutor

A service for executing migration commands against a database.

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

IMigrationsAnnotationProvider

A service typically implemented by database providers that gives access to annotations used by EF Core Migrations when generating removal operations for various elements of the IRelationalModel. The annotations stored in the relational model are provided by IRelationalAnnotationProvider.

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

IMigrationsAssembly

A service representing an assembly containing EF Core Migrations.

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.

IMigrationsIdGenerator

A service for generating migration identifiers from names and names from identifiers.

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

IMigrationsModelDiffer

A service for finding differences between two IRelationalModels and transforming those differences into MigrationOperations that can be used to update the database.

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.

IMigrationsSqlGenerator

A service for generating MigrationCommand objects that can then be executed or scripted from a list of MigrationOperations.

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.

IMigrator

The main service used to generated an EF Core Migrations script or migrate a database directly.

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.

Enums

MigrationsSqlGenerationOptions

The options to use when generating SQL for migrations.

ReferentialAction

The action that a database may take when handling a foreign key constraint as part of an update or delete.

Note that some database engines do not support or correctly honor every action.