Table of Contents

Class Migrator

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

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.

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 class Migrator : IMigrator
Inheritance
Migrator
Implements
Inherited Members

Constructors

Migrator(IMigrationsAssembly, IHistoryRepository, IDatabaseCreator, IMigrationsSqlGenerator, IRawSqlCommandBuilder, IMigrationCommandExecutor, IRelationalConnection, ISqlGenerationHelper, ICurrentDbContext, IConventionSetBuilder, IDiagnosticsLogger<Migrations>, IDiagnosticsLogger<Command>, IDatabaseProvider)

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.

public Migrator(IMigrationsAssembly migrationsAssembly, IHistoryRepository historyRepository, IDatabaseCreator databaseCreator, IMigrationsSqlGenerator migrationsSqlGenerator, IRawSqlCommandBuilder rawSqlCommandBuilder, IMigrationCommandExecutor migrationCommandExecutor, IRelationalConnection connection, ISqlGenerationHelper sqlGenerationHelper, ICurrentDbContext currentContext, IConventionSetBuilder conventionSetBuilder, IDiagnosticsLogger<DbLoggerCategory.Migrations> logger, IDiagnosticsLogger<DbLoggerCategory.Database.Command> commandLogger, IDatabaseProvider databaseProvider)

Parameters

migrationsAssembly IMigrationsAssembly
historyRepository IHistoryRepository
databaseCreator IDatabaseCreator
migrationsSqlGenerator IMigrationsSqlGenerator
rawSqlCommandBuilder IRawSqlCommandBuilder
migrationCommandExecutor IMigrationCommandExecutor
connection IRelationalConnection
sqlGenerationHelper ISqlGenerationHelper
currentContext ICurrentDbContext
conventionSetBuilder IConventionSetBuilder
logger IDiagnosticsLogger<Migrations>
commandLogger IDiagnosticsLogger<Command>
databaseProvider IDatabaseProvider

Methods

GenerateDownSql(Migration, Migration, MigrationsSqlGenerationOptions)

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.

protected virtual IReadOnlyList<MigrationCommand> GenerateDownSql(Migration migration, Migration previousMigration, MigrationsSqlGenerationOptions options = MigrationsSqlGenerationOptions.Default)

Parameters

migration Migration
previousMigration Migration
options MigrationsSqlGenerationOptions

Returns

IReadOnlyList<MigrationCommand>

GenerateScript(string, string, MigrationsSqlGenerationOptions)

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.

public virtual string GenerateScript(string fromMigration = null, string toMigration = null, MigrationsSqlGenerationOptions options = MigrationsSqlGenerationOptions.Default)

Parameters

fromMigration string
toMigration string
options MigrationsSqlGenerationOptions

Returns

string

GenerateUpSql(Migration, MigrationsSqlGenerationOptions)

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.

protected virtual IReadOnlyList<MigrationCommand> GenerateUpSql(Migration migration, MigrationsSqlGenerationOptions options = MigrationsSqlGenerationOptions.Default)

Parameters

migration Migration
options MigrationsSqlGenerationOptions

Returns

IReadOnlyList<MigrationCommand>

Migrate(string)

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.

public virtual void Migrate(string targetMigration = null)

Parameters

targetMigration string

MigrateAsync(string, CancellationToken)

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.

public virtual Task MigrateAsync(string targetMigration = null, CancellationToken cancellationToken = default)

Parameters

targetMigration string
cancellationToken CancellationToken

Returns

Task

PopulateMigrations(IEnumerable<string>, string, out IReadOnlyList<Migration>, out IReadOnlyList<Migration>, out Migration)

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.

protected virtual void PopulateMigrations(IEnumerable<string> appliedMigrationEntries, string targetMigration, out IReadOnlyList<Migration> migrationsToApply, out IReadOnlyList<Migration> migrationsToRevert, out Migration actualTargetMigration)

Parameters

appliedMigrationEntries IEnumerable<string>
targetMigration string
migrationsToApply IReadOnlyList<Migration>
migrationsToRevert IReadOnlyList<Migration>
actualTargetMigration Migration