Reputation: 2111
I'm setting up EF Core 3.1.3 migrations against an existing SQL Server database.
This is what I've done so far:
Then I added a property to an entity class and ran dotnet ef add migration
.
Now looking at the BuildTargetModel method of the second migration I see that it contains pretty much the same code as MyDbContextModelSnapshot.BuildModel. I.e. it lists all entities and all their properties and relationships.
What does BuildTargetModel on a migration do? Why does it have to duplicate most of the snapshot code? I would only expect to find the diff in a migration.
Upvotes: 3
Views: 1077
Reputation: 2111
As confirmed by the developers of EF Core, this behaviour is by design:
https://github.com/dotnet/EntityFramework.Docs/issues/2288
Upvotes: 2