-
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
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) | ||
var dangles = _danglingJoinEntities.ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.