Closed Angus221 closed 1 year ago
EFCore 5 is no longer supported. See: https://learn.microsoft.com/en-us/ef/core/what-is-new/#stable-releases Did you also try this on EFCore 6 or EFCore 7? If you can reproduce this on EFCore6 and EfCore7, you should include a fully reproducable sample incl. model building code etc.
fix
When I update multiple entities whose navigation properties are the same object, only one of the entities is successfully updated, and the others are not.
Code
Entities
update code
In the above example, only one entity was updated successfully,the remaining two entities did not generate any updated SQL;
If I don't use "include", all entities can be updated successfully, just like:
If I set the navigation property to Null, all entities can be updated successfully as well,just like:
If the navigation properties are not the same, all entities can be updated successfully,just like:
So I'm guessing entities with the same navigation properties, only one of them will be updated, but I'm wondering why?
provider and version information
EF Core version: EF Core 5.0.5 Database provider:Microsoft.EntityFrameworkCore.SqlServer Target framework: NET 5.0 Operating system: IDE: Visual Studio 2022 17.1.4