-
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
Persist Id
values into owned collection JSON documents
#34466
Conversation
Did you mean to target |
test/EFCore.Cosmos.FunctionalTests/Query/JsonQueryCosmosTest.cs
Outdated
Show resolved
Hide resolved
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.
Throw in validation for persisted keys in JSON
No, I meant to merge into main and backport. I'm still not sure what the bar is or how it will be measured, so I didn't want to be left with another PR I can't merge--looking at you, code cleanup! :-D |
Fixes #29380 There are several aspects to #29380: - Constructor binding (already fixed) - Round-tripping the `Id` property value (addressed by this PR) - Persisting key values in JSON collection documents (tracked by #28594) I investigated persisting key values, but identity lookup requires key values in the materializer before we do the parsing of the document. This means persisted key values are not available without re-writing this part of the shaper, which we can't do for 9. To fix the main issue (round-trip `Id`) this PR changes the way identity on owned JSON collection documents works. Instead of discovering and using the `Id` property, we treat it like any other property. We then create a shadow `__synthesizedOrdinal` property to act as the ordinal part of the key. We need to discuss: - Is this breaking for any scenario that was working before? - Does this put us in a bad place for the future of owned types with explicit keys?
* Persist `Id` values into owned collection JSON documents Fixes #29380 There are several aspects to #29380: - Constructor binding (already fixed) - Round-tripping the `Id` property value (addressed by this PR) - Persisting key values in JSON collection documents (tracked by #28594) I investigated persisting key values, but identity lookup requires key values in the materializer before we do the parsing of the document. This means persisted key values are not available without re-writing this part of the shaper, which we can't do for 9. To fix the main issue (round-trip `Id`) this PR changes the way identity on owned JSON collection documents works. Instead of discovering and using the `Id` property, we treat it like any other property. We then create a shadow `__synthesizedOrdinal` property to act as the ordinal part of the key. We need to discuss: - Is this breaking for any scenario that was working before? - Does this put us in a bad place for the future of owned types with explicit keys? * Added validation of no explicit keys
* Persist `Id` values into owned collection JSON documents Fixes #29380 There are several aspects to #29380: - Constructor binding (already fixed) - Round-tripping the `Id` property value (addressed by this PR) - Persisting key values in JSON collection documents (tracked by #28594) I investigated persisting key values, but identity lookup requires key values in the materializer before we do the parsing of the document. This means persisted key values are not available without re-writing this part of the shaper, which we can't do for 9. To fix the main issue (round-trip `Id`) this PR changes the way identity on owned JSON collection documents works. Instead of discovering and using the `Id` property, we treat it like any other property. We then create a shadow `__synthesizedOrdinal` property to act as the ordinal part of the key. We need to discuss: - Is this breaking for any scenario that was working before? - Does this put us in a bad place for the future of owned types with explicit keys? * Added validation of no explicit keys
Fixes #29380
There are several aspects to #29380:
Id
property value (addressed by this PR)I investigated persisting key values, but identity lookup requires key values in the materializer before we do the parsing of the document. This means persisted key values are not available without re-writing this part of the shaper, which we can't do for 9.
To fix the main issue (round-trip
Id
) this PR changes the way identity on owned JSON collection documents works. Instead of discovering and using theId
property, we treat it like any other property. We then create a shadow__synthesizedOrdinal
property to act as the ordinal part of the key.We need to discuss: