forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JSON source gen 3/3] Add new methods to JsonSerializer and System.Ne…
…t.Http.Json APIs that take type metadata (dotnet#51528) * Add new methods to JsonSerializer and System.Net.Http.Json APIs that take type metadata * Address review feedback
- Loading branch information
Showing
41 changed files
with
2,004 additions
and
322 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
33 changes: 33 additions & 0 deletions
33
src/libraries/System.Net.Http.Json/tests/FunctionalTests/JsonContext/Int32.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Text.Json.Serialization; | ||
using System.Text.Json.Serialization.Metadata; | ||
|
||
namespace System.Net.Http.Json.Functional.Tests | ||
{ | ||
internal partial class JsonContext : JsonSerializerContext | ||
{ | ||
private JsonTypeInfo<int> _Int32; | ||
public JsonTypeInfo<int> Int32 | ||
{ | ||
get | ||
{ | ||
if (_Int32 == null) | ||
{ | ||
JsonConverter customConverter; | ||
if (Options.Converters.Count > 0 && (customConverter = GetRuntimeProvidedCustomConverter(typeof(int))) != null) | ||
{ | ||
_Int32 = JsonMetadataServices.CreateValueInfo<int>(Options, customConverter); | ||
} | ||
else | ||
{ | ||
_Int32 = JsonMetadataServices.CreateValueInfo<int>(Options, JsonMetadataServices.Int32Converter); | ||
} | ||
} | ||
|
||
return _Int32; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.