[release/8.0] Cosmos: Generate ordinal values for key properties that used not to be persisted. #32489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Port of #32469
Fixes #32363
Fixes #32410
Description
We fixed #31664 for 8.0 RTM. It was a known breaking change, but had bigger impact then initially thought for existing databases. With that fix the nested entities fail to load when queried as the now required key value is missing. The new fix is to use a generated ordinal value in this case (this is the same value that the property would have had in 8.0.0-rc2 and previous versions).
Customer impact
Users with an existing database that use a model with nested owned collections where the entity type has an
int
property that matches our key convention (e.g. namedId
) are either getting an exception during query execution or the nested collection is silently lost.How found
Customers reported on 8.0
Regression
Yes
Testing
Added.
Risk
Low, reverses some of the behavior changed in a previous fix. Added a quirk for this fix and also for #31664 in case there are more scenarios not covered by the current fix.