I'm looking into using Protobuf to send data between my Microservices, and
I'm using the C# support in Google.ProtoBuf and not ProtoBuf-Net, since I want to compile classes from .proto files.
The reason for this is the Microservices are not strictly .Net. Some of the are written in Go etc.
I'm looking for something like the ProtoBufFormatter in the package WebApiContrib.Formatting.ProtoBuf, but support Google.ProtoBuf.
The ProtoBufFormatter returns serialized protobuf data if the client have set content type to application/x-protobuf, otherwise Json.
How can I achieve something similar for Google.ProtoBuf? Further I'm also looking into find this kind of support for the Nancy Framework on .Net Core as well.
I have found this link where it explains how to use protobuf files with Protobuf-Net, but does not seem up to date (.Net Core + VSCode).
I could not find any solution for my use case with
Google.Protobuf, so I used a customInputFormatterandOutputFormatterlike in this blog post, withProtobuf-Net.Then to call and deserialize the protobuf content in the client, I came up with this solution:
Next step will be to figure out how to create models from
.protofiles withProtobuf-Net.