Incorrect tracking state of loaded Entities when using ChangeTrackingStrategy.ChangedNotifications #7803
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
When working with ChangeTrackingStrategy.ChangedNotifications, loading related entities using
table.Where(predicate).Include(x => x.Relations).ToList()
leads to the loaded related entities having a tracking state of 'Added' rather than 'Unchanged'. Trying to SaveChanges after this has happened leads to an exception due to unique constraint failed (trying to insert the same loaded entity into the table with it's existing primary key value).
Steps to reproduce
The following code reproduces the issue. Full code attached.
ConsoleApplication10.zip
Further technical details
EF Core version: 1.1.1
Database Provider: Microsoft.EntityFrameworkCore.Sqlite
Operating system: Windows 10
IDE: Visual Studio 2015
The text was updated successfully, but these errors were encountered: