[release/10.0] Fix deletion of entities with non-empty complex collection#37382
[release/10.0] Fix deletion of entities with non-empty complex collection#37382AndriySvyryd merged 2 commits intorelease/10.0from
Conversation
|
@AndriySvyryd When you say a workaround is to clear the complex collections do you mean clear it and persist changes then in a separate operation delete the parent or just explicitly clear it? |
Just clear them on any entity being deleted, in the same SaveChanges |
|
cc @artl93 |
artl93
left a comment
There was a problem hiding this comment.
Tentatively approved... new feature, multiple customer reports, simple fix.
How obvious is the workaround?
|
The workaround is somewhat discoverable for developers familiar with how SaveChanges is implemented, but so far I haven't seen any reports of it being discovered naturally. |
|
Thanks - include that workaround evidence (or lack thereof) in the tactics approval, please. |
Fixes #37373
Port of #37377
Description
EF added support for complex collections in 10, but the update pipeline contains an access pattern that's invalid for deleted entities.
Customer impact
When deleting an entity with a non-empty complex collection, an exception is thrown. A workaround is to clear the complex collections for any deleted entity.
How found
Multiple customer reports on EF 10.0.0
Regression
No, complex collections were introduced in EF 10.
Testing
Tests added
Risk
Low. Quirk added.