-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion. Use a stable sorting algorithm #25228
Comments
This change allows to solve #11686 |
Did you perform any testing that would show that this change would make any difference? However, even if it would, the order in which the modification commands are in after the topological sort doesn't necessarily reflect the order of the items in the collection navigations. Instead https://github.com/dotnet/efcore/blob/ac2bb48b10ecf1289b568a94b7a35e8075c6d787/src/EFCore.Relational/Update/Internal/ModificationCommandComparer.cs should be changed to compare keys on inserted entities too. This will reflect the order in which they were added to the change tracker, which should be closer to what is expected in #11686 |
Yes, I did some testing, this change works. But your approach (change ModificationCommandComparer) will be better. |
Suggestion. Use a stable sorting algorithm when forming the sequence of command for insert and updating entities.
https://github.com/dotnet/efcore/blob/main/src/EFCore.Relational/Update/Internal/CommandBatchPreparer.cs#L81
The text was updated successfully, but these errors were encountered: