Skip to content
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

More about how to preserve references #22322

Merged
merged 11 commits into from
Feb 16, 2021
Merged

Conversation

tdykstra
Copy link
Contributor

@tdykstra tdykstra commented Jan 12, 2021

Copy link
Contributor

@luisquintanilla luisquintanilla left a comment

Choose a reason for hiding this comment

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

@tdykstra LGTM.

Copy link
Contributor

@layomia layomia left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!


::: zone pivot="dotnet-5-0"

By default, reference data is only cached for each call to <xref:System.Text.Json.JsonSerializer.Serialize%2A> or <xref:System.Text.Json.JsonSerializer.Deserialize%2A>. To persist references from one `Serialize`/`Deserialize` call to another one, root the <xref:System.Text.Json.Serialization.ReferenceResolver> instance in the call site of `Serialize`/`Deserialize`. The following code shows an example for this scenario:
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this example covers serialization, maybe mention somewhere in this section that a similar approach can be adopted for deserialization.

…es.md

Co-authored-by: Layomi Akinrinade <layomia@gmail.com>
@tdykstra tdykstra merged commit 22ed8e5 into dotnet:master Feb 16, 2021
@tdykstra tdykstra deleted the presrefconv branch February 16, 2021 18:59
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.

ReferenceHandler.Preserve does not work well with JsonConverters
5 participants