Table of Contents

Interface IMigrationsAssembly

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

A service representing an assembly containing EF Core Migrations.

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 interface IMigrationsAssembly
Extension Methods

Properties

Assembly

The assembly that contains the migrations, snapshot, etc.

Assembly Assembly { get; }

Property Value

Assembly

Migrations

A dictionary mapping migration identifiers to the TypeInfo of the class that represents the migration.

IReadOnlyDictionary<string, TypeInfo> Migrations { get; }

Property Value

IReadOnlyDictionary<string, TypeInfo>

ModelSnapshot

The snapshot of the Microsoft.EntityFrameworkCore.Metadata.IModel contained in the assembly.

ModelSnapshot ModelSnapshot { get; }

Property Value

ModelSnapshot

Methods

CreateMigration(TypeInfo, string)

Creates an instance of the migration class.

Migration CreateMigration(TypeInfo migrationClass, string activeProvider)

Parameters

migrationClass TypeInfo

The TypeInfo for the migration class, as obtained from the Migrations dictionary.

activeProvider string

The name of the current database provider.

Returns

Migration

The migration instance.

FindMigrationId(string)

Finds a migration identifier in the assembly with the given a full migration name or just its identifier.

string FindMigrationId(string nameOrId)

Parameters

nameOrId string

The name or identifier to lookup.

Returns

string

The identifier of the migration, or null if none was found.