-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting pedning migrations with EF Core 6 #24448
Comments
This is tracked at dotnet/EntityFramework.Docs#3030 var snapshotModel = migrationsAssembly.ModelSnapshot?.Model;
if (snapshotModel is IMutableModel mutableModel)
{
snapshotModel = mutableModel.FinalizeModel();
}
if (snapshotModel != null)
{
snapshotModel = context.GetService<IModelRuntimeInitializer>().Initialize(snapshotModel);
hasDifferences = modelDiffer.HasDifferences(snapshotModel.GetRelationalModel(), context.Model.GetRelationalModel());
}
hasDifferences = modelDiffer.HasDifferences(snapshotModel.GetRelationalModel(), context.DesignModel.GetRelationalModel()); |
Thanks, just had to change: .Initialize(snapshotModel, null) |
@AndriySvyryd - did this not make it into 6.0 preview 3?
|
@ErikEJ No and for preview4 we changed the API to hasDifferences = context.GetService<IMigrationsModelDiffer>().HasDifferences(
snapshotModel.GetRelationalModel(),
context.GetService<IDesignTimeModel>().Model.GetRelationalModel()); |
Hmmm.. not exactly intuitive! Thanks. |
That's by-design 😄. We think that very few users would actually need that and if it turns out to be false, then we'll introduce an even simpler sugar API where the code in #24448 (comment) is replaced by a single call. |
You are probably right, I am the only person in the world who cares! |
I am using this with EF Core 5, but get Obsolete warnings:
'TypeMappingConvention' is obsolete: 'Use IModelRuntimeInitializer.Initialize instead.'
'RelationalModelConvention' is obsolete: 'Use IModelRuntimeInitializer.Initialize instead.'
Not really sure how to proceed...
EF Core version: 6.0
Target framework: NET 5.0
The text was updated successfully, but these errors were encountered: