DetectChanges should honor store-generated key values when tracking new entities #14616
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
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.
The text was updated successfully, but these errors were encountered: