'Detect whether model and database out of sync in EF Core 5
I'm using the "Create and Drop" APIs since my model changes often.
After a model change, I call dotnet ef database drop, and on next run the system calls context.Database.EnsureCreated() to recreate the database. I could precede that with context.Database.EnsureDeleted() but I don't want to drop/recreate the database every time (it slows down the development "inner loop", and it'll hammer my drive).
There used to be an easy way (in old EF) to programmatically detect if the database and model are out of sync. There isn't such a built-in feature in EF Core. There are some ways (e.g., e.g.) but they are a few years old, unreliable (depend on internal features) and for older versions.
Is there a stable way - without using internal assembly features - to do this in v5?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
