Open charlesRollandy opened 1 week ago
@charlesRollandy I may be missing something here, but if you create a new, empty, SQLite in-memory database, then the schema will be empty and HasPendingModelChanges
should always return true.
@ajcvickers HasPendingModelChanges
is not looking if the model changes are applied to the database but if some changes into the entities are not reflected with migrations.
What is actually weird is that the cli provides the correct result but not the method from the SDK. Could if be related to configuration ?
I have an application with a database project and a data migration project. I wrote a unit test in a dedicated project to test there is no pending changes in my model and no migration is required.
My solution has the following structure:
This us my unit test in AppDbContext.cs:
This test always fails.
HasPendingModelChanges
always returns trueThis is the code of DesignTimeDbContextFactory.cs
When I open a terminal from the
Database.Migrations
folder and run the commanddotnet ef migrations has-pending-model-changes
it gives me the correct result. I tried using the same database provider in my unit test but the result was the same. It doesn't look to be related to that.EF Core version: 8.0.10 Target framework: (e.g. .NET 8.0) Operating system: Windows 11 IDE: (e.g. Visual Studio 2022 17.11.5)