You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We add an entity, save it to database. Now entity is in change tracker.
Then database is recreated with EnsureDeleted/EnsureCreated
Same entity cannot be added again since it is still tracked.
The text was updated successfully, but these errors were encountered:
In particular, if in a test scenario you add one entity to an empty database, then delete the database, then add another new entity, it blows up (using InMemory). Because both are assigned ID 1, which is being tracked.
We decided in triage that this is by design. If you delete your database in the middle of processing then your DbContext may not be usable. It would be fine pattern to initialize new DbContext or recreate database at very start of processing.
Repro is in #6872 (comment)
We add an entity, save it to database. Now entity is in change tracker.
Then database is recreated with EnsureDeleted/EnsureCreated
Same entity cannot be added again since it is still tracked.
The text was updated successfully, but these errors were encountered: