Skip to content

Use our new JSON serialization infra for partial updates - #31232

Merged
roji merged 1 commit into
dotnet:mainfrom
roji:JsonPartialUpdates
Jul 13, 2023
Merged

roji merged 1 commit into
dotnet:mainfrom
roji:JsonPartialUpdates

Conversation

@roji

@roji roji commented Jul 11, 2023

Copy link
Copy Markdown
Member

This uses the type mapping's new JsonValueReaderRewriter for generating the JSON representation for single-property partial updates.

In addition, when the database's partial update function (e.g. JSON_MODIFY) accepts a non-JSON relational value (e.g. int), simply send that value via the property's regular type mapping. We were previously always converting values (e.g. int) to a JSON string representation, and then applying a SQL cast inside JSON_MODIFY. This has been removed, and we just send regular relational int parameters instead.

@ajcvickers you'll probably be interested in this too.

@roji
roji requested review from ajcvickers and maumar July 11, 2023 22:52
@roji
roji force-pushed the JsonPartialUpdates branch from e87ab5c to e24df3b Compare July 11, 2023 23:09
parameters = parameters with
{
Value = Encoding.UTF8.GetString(stream.ToArray())[1..^1]
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all of this should go away once I have my changes in.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great!

In addition, when the database's partial update function (e.g.
JSON_MODIFY) accepts a non-JSON relational value (e.g. int), simply
send that value via the property's regular type mapping.
@roji
roji force-pushed the JsonPartialUpdates branch from e24df3b to e2cd57e Compare July 13, 2023 17:40
@roji
roji merged commit b931a3d into dotnet:main Jul 13, 2023
@roji
roji deleted the JsonPartialUpdates branch July 13, 2023 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants