Repository navigation
Fixes and cleanup around JSON collection SQL value conversions - #31261
Merged
Merged
Conversation
bricelam
reviewed
Jul 14, 2023
maumar
reviewed
Jul 17, 2023
maumar
reviewed
Jul 17, 2023
|
|
||
| [ConditionalFact] | ||
| public override Task Array_of_byte() | ||
| => base.Array_of_byte(); |
Contributor
There was a problem hiding this comment.
maybe we need list of test names to exempt from Check_all_tests_overridden?
Member
Author
There was a problem hiding this comment.
We could, though I think it's not too bad like this... It even makes me explicitly see that we're not really overriding, i.e. that for byte arrays we assert failure in the base etc.
maumar
approved these changes
Jul 17, 2023
Member
Author
|
Pay special attention to SQLite Array_of_TimeOnly after #31272 is merged (https://github.com/dotnet/efcore/pull/31272/files#r1264439804 after that's merged) |
roji
force-pushed
the
JsonServerConversions
branch
from
July 18, 2023 11:48
d0a8f59 to
63f2828
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This does work around SQL logic for converting values out of JSON so they can be further queried in SQL. Originally I thought we may want to add a general API on the type mappings, but I don't think that makes sense at this point. The conversions needed for SQLite are concentrated in a single simple method, and there's no real value in refactoring that out to the type mappings (SQL Server doesn't need any). We can always change this in the future, but for now I think we should leave this as an internal implementation detail of each provider.
The update pipeline doesn't need to perform server-side conversions to JSON; we simply generate the JSON representation we want client-side, and send the appropriate parameter for that (e.g. a JSON string representation of a timestamp). An alternative approach would be to e.g. send a regular DateTime parameter, and then use SQL to convert that to the JSON string representation. But there's no real advantage in that, and it's complex/not always possible. I've done some cleanup/improvement to partial updating in #31232, but I don't think anything else is needed at this point.
(Note that if we ever want to allow a JSON property to be a key/concurrency token, the update pipeline would need to apply the same conversions as the query pipeline (because it would need to appear in the UPDATE WHERE clause)
Specific notes on what's converted and what's not supported:
datetime()to remove the T) and Guid (uppercase)Related to #30727