Skip to content

Commit

Permalink
Set MyJsonSerializerContext.Default explicitly
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam committed Nov 15, 2023
1 parent 8b6f9ef commit 6d95b90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ public partial class MyJsonSerializerContext : JsonSerializerContext
// register generated converters to options
UsePolymorphicConverters(s_defaultOptions.Converters);
UseEnumConverters(s_defaultOptions.Converters);

#if NET8_0_OR_GREATER
Default = new MyJsonSerializerContext(new System.Text.Json.JsonSerializerOptions(s_defaultOptions));
#endif
}
}
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
using Aviationexam.GeneratedJsonConverters.SourceGenerator.Target.ContractWithCustomDelimiter;
using System.Collections.Generic;
using System.Text.Json.Serialization;
#if NET8_0_OR_GREATER
using System.Text.Json;
#endif

namespace Aviationexam.GeneratedJsonConverters.SourceGenerator.Target;

Expand Down Expand Up @@ -30,5 +33,9 @@ static MyJsonSerializerContext()
{
UsePolymorphicConverters(s_defaultOptions.Converters);
UseEnumConverters(s_defaultOptions.Converters);

#if NET8_0_OR_GREATER
Default = new MyJsonSerializerContext(new JsonSerializerOptions(s_defaultOptions));
#endif
}
}

0 comments on commit 6d95b90

Please sign in to comment.