Ability to use System.Text.Json's generated sources to improve PersistentComponentState's json read performance
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Is your feature request related to a problem? Please describe the problem.
_No response_
### Describe the solution you'd like
PersistentComponentState's TryTakeFromJson method uses System.Text.Json's auto generated sources of JsonSerializerContext & JsonSerializable
I'd like to use something like what asp.net core web API has as followings:
```cs
services
.AddControllers...
.AddJsonOptions(options => options.JsonSerializerOptions.AddContext());
```
So aspnet core web API uses MyAppJsonContext globally to improve its performance.
I'd like to use generated sources of System.Text.Json in client side to read transferred json state
Currently blazor uses [JsonSerializerOptionsProvider](https://github.com/dotnet/aspnetcore/blob/main/src/Components/Shared/src/JsonSerializerOptionsProvider.cs) which is internal and we can't call .AddContext() to make sure it has access to our source generator based context
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.