-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More (binary) serializers support: protobuf, messagepack #305
Comments
Hi - thanks for the feature suggestion. I think it'd make an excellent suggestion! I'm not very familiar with this stuff though, so I'll do a bit of research and add them - hopefully within a week or so. Thanks again! |
I've dug a bit into it and looks like MessagePack formatter is very simple:
But the protobuf one seems to be pointless overall - it will require adding this type to proto, protobuf-gen wont recognize that special type anyway... Looks like this conversion must be done manually/on mapping stage and does not require any special handling, so can be avoided :) |
Also there is very interesting MemoryPack that I wanted to try out, but it uses its own roslyn generator and it fails even building project where it and vogen are added at the same time :( |
Interesting! Many thanks, I'll take a look at those. |
protobuf-net can be used with Vogen types very easily if adding dependency to protobuf-net is OK, but this information is not easy to find imho. I guess it's possible to set surrogate for every required type at the runtime too, but this seems more convenient for my use case. [ValueObject(typeof(string))]
[ProtoContract(Surrogate = typeof(string))]
public partial class BoxId {
//...
} BoxId type now will be serialized as a string in all messages/grpc calls. If one is generating .proto files for other applications from C# code, proto files will include Surrogate type as the type. |
Many thanks for the feedback @DomasM ! I'll certainly add that to the readme! |
Describe the feature
These serializers (protobuf-net, messagepack-csharp) are fast binary ones, already stated as industry standards (like, protobuf is used in gRPC) and they require a bit special handling: members decoration with attributes, accessible constructor.
These two are pretty hard to be added to models, generated with current version of Vogen.
Messagepack can make use of
[SerializationConstructor]
attribute, for example.PS: Or is it possible to deal with these using current Vogen version and I (maybe) missed some guide for it?
The text was updated successfully, but these errors were encountered: