JsonMergePatch and .NET6
12/18/2021
In a previous post I have shown how JsonMergePatch library can be used with console and Asp.Net Core applications.
In this post I will focus on using it with the source generator hand-in-hand of System.Text.Json. Before getting into the details, a new [Patchable]
attribute is introduced ease the work:
Patchable
Certain use-cases require to generate wrapper types with the source generation for assemblies that do not directly use Patch<T>
(where T is the wrapped source type). This could be a reason for having separate assemblies for entity types, or because of the need of stacking multiple source generators on top of each other.In this case types may be attributed with [Patchable]
attribute: