Fixup navigations to/from join entity when new many-to-many relationship is created - #26853
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
036d9f7 to
fabea3f
Compare
fabea3f to
e7ef95a
Compare
| if (_danglingJoinEntities != null) | ||
| { | ||
| if (_danglingJoinEntities != null) | ||
| var dangles = _danglingJoinEntities.ToList(); |
There was a problem hiding this comment.
Why are you changing this? Is there a way that something could be added to _danglingJoinEntities during CompleteDelayedFixup()?
There was a problem hiding this comment.
I don't believe so. However, BeginDelayedFixup can be called again, and we clear any existing danglers when this happens. This shouldn't be needed if everything is working correctly, but it is there against the possibility that some error happens when, for example, attaching the graph, and we leave the collection in a bad state. We could not do this, but it felt slightly more robust to keep doing it.
There was a problem hiding this comment.
I agree that this is more robust, but I'd prefer us to throw when an error happens rather than try to keep consistency.
You could throw in BeginDelayedFixup if _inAttachGraph is false and _danglingJoinEntities is not empty
There was a problem hiding this comment.
You don't need to call ToList() anymore.
Also could avoid some allocations if you don't null-out _danglingJoinEntities
There was a problem hiding this comment.
Do you think it's better to keep the list around (even though it may not be used again, or not used for some time) rather than create a new one if we happen to need it again? (I've been wondering about this.)
There was a problem hiding this comment.
I think that the chance of the list being used goes up significantly after it has been used once.
e7ef95a to
270c09e
Compare
- Throw if delayed fixup is left in an invalid state - Store arguments rather than delegate
270c09e to
61f8450
Compare
Fixes #26779
Also cleanup of delay-fixup/suspended detection logic, and tests for #26074.