Skip to content
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

DetectChanges should honor store-generated key values when tracking new entities #14616

Closed
ajcvickers opened this issue Feb 5, 2019 · 0 comments
Assignees
Labels
breaking-change closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@ajcvickers
Copy link
Member

Split off from #13575 to track for 3.0 as a breaking change.

Traditionally any un-tracked entities found by DetectChanges are put into the Added state. However, if the entity type is using store-generated keys and the key value is set, then it is safe to assume that the entity must actually exist, since otherwise it could not have a key value. This change marks such entities as Modified instead of Added.

Note that any entity type that doesn't use generated keys will still have the old behavior. That is, entities will always be in the Added state, regardless of the key value.

The only break here is if the application is configured to use generated values, but isn't really using them. This may be most likely for strings--I will file an issue for this.

@ajcvickers ajcvickers added this to the 3.0.0 milestone Feb 5, 2019
@ajcvickers ajcvickers self-assigned this Feb 5, 2019
ajcvickers added a commit that referenced this issue Feb 6, 2019
… entities

Issue #14616

Detected entities with generated key values that have already been set are marked as Modified instead of Added.

Also, some re-working of the EntityGraphAttacher to make the node generic on TState.
ajcvickers added a commit that referenced this issue Feb 6, 2019
… entities

Issue #14616

Detected entities with generated key values that have already been set are marked as Modified instead of Added.

Also, some re-working of the EntityGraphAttacher to make the node generic on TState.
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 6, 2019
ajcvickers added a commit that referenced this issue Feb 6, 2019
… entities (#14628)

Issue #14616

Detected entities with generated key values that have already been set are marked as Modified instead of Added.

Also, some re-working of the EntityGraphAttacher to make the node generic on TState.
@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview3 Feb 22, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview3, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

1 participant