-
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
What should happen when attaching an inconsistent entity? #1246
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-unknown
Milestone
Comments
ajcvickers
added a commit
that referenced
this issue
Dec 10, 2014
Issue #1247. Calling Remove for and Added entity still resulted in the Detached (Unknown) state, but now setting the state to Deleted does result in the Deleted state. The only place where setting a state may result in a different state is when attempting to set to Unchanged with an FK that is inconsistent. See #1246.
Current decision on this is that in the case where the FK is not consistent with the graph it is acceptable to change the FK and mark the entity as modified. It isn't really Attaching that is doing this, but the associated fixup that happens, and this is what fixup is supposed to do. |
ajcvickers
added a commit
that referenced
this issue
Dec 10, 2014
Issue #1247. Calling Remove for and Added entity still resulted in the Detached (Unknown) state, but now setting the state to Deleted does result in the Deleted state. The only place where setting a state may result in a different state is when attempting to set to Unchanged with an FK that is inconsistent. See #1246.
ajcvickers
added
the
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
label
Oct 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-unknown
Consider calling Attach, AttachGraph, or setting the state of an entity to Unchanged. The expectation is that the state of the entity will be Unchanged. However, what if the entity references a principal with a PK that doesn't match the FK in the new entity? We discussed this at length when implementing FK support in the old stack and came to the conclusion that we should throw a constraint exception. One of the alternatives was to fixup the FK and mark the entity as Modified. This is currently the behavior in the new stack for AttachGraph, and may not be totally unreasonable given:
The text was updated successfully, but these errors were encountered: