Protobuf Source Generator
06/24/2023
I have recently faced a challenge where significant amount of custom types had to be serializable with protobuf-net. A requirement for the task was to avoid attributing all properties with [ProtoMember]
. A solution to this problem is using C# source generators to generate partial types with properties that are serializable. Such a source generator is described below and implemented in LaDeak.ProtobufSourceGenerator nuget package and GitHub project.
A source generator that generates partial helper classes where member properties are attributed with ProtoMember attribute for serialization with protobuf-net.
Getting Started
Install nuget package: