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.
public interface IMigrationsModelDiffer
Remarks
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.
See Database migrations for more information and examples.
Methods
GetDifferences(IRelationalModel?, IRelationalModel?)
Finds the differences between two models.
IReadOnlyList<MigrationOperation> GetDifferences(IRelationalModel? source, IRelationalModel? target)
Parameters
source
IRelationalModelThe model as it was before it was possibly modified.
target
IRelationalModelThe 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
IRelationalModelThe first model.
target
IRelationalModelThe second model.