Table of Contents

Interface IMigrationsModelDiffer

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

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 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 IMigrationsModelDiffer

Methods

GetDifferences(IRelationalModel, IRelationalModel)

Finds the differences between two models.

IReadOnlyList<MigrationOperation> GetDifferences(IRelationalModel source, IRelationalModel target)

Parameters

source IRelationalModel

The model as it was before it was possibly modified.

target IRelationalModel

The model as it is now.

Returns

IReadOnlyList<MigrationOperation>

A list of the operations that need to applied to the database to migrate it from mapping to the source model so that is now mapping to the target model.

HasDifferences(IRelationalModel, IRelationalModel)

Checks whether there are differences between the two models.

bool HasDifferences(IRelationalModel source, IRelationalModel target)

Parameters

source IRelationalModel

The first model.

target IRelationalModel

The second model.

Returns

bool

true if there are any differences and false otherwise.