IMigrator Interface
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
The main service used to generated an EF Core Migrations script or migrate a database directly.
public interface IMigrator
type IMigrator = interface
Public Interface IMigrator
Remarks
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
GenerateScript(String, String, Boolean) |
Generates a SQL script to migrate a database either in its entirety, or starting and ending at specified migrations. |
GenerateScript(String, String, MigrationsSqlGenerationOptions) |
Generates a SQL script to migrate a database either in its entirety, or starting and ending at specified migrations. |
Migrate(String) |
Migrates the database to either a specified target migration or up to the latest migration that exists in the IMigrationsAssembly. |
MigrateAsync(String, CancellationToken) |
Migrates the database to either a specified target migration or up to the latest migration that exists in the IMigrationsAssembly. |
Applies to
Entity Framework