I am incorporating Google Proto Buffers into my project and it is really nice how protoc.exe for windows generates header and source files for serialization/deserialization. I need protobuf.net code generator. So, for example if I a class Person, I first need to define it in the .proto file. Then when I run protoc.exe on it, it will give me the .h and .c files. But then manually, I have to do the following for the Person class:
[ProtoContract]
class Person {
[ProtoMember(1)]
public int Id {get;set;}
[ProtoMember(2)]
public string Name {get;set:}
[ProtoMember(3)]
public Address Address {get;set;}
}
[ProtoContract]
class Address {
[ProtoMember(1)]
public string Line1 {get;set;}
[ProtoMember(2)]
public string Line2 {get;set;}
}
And I want everything automated. So, technically I would want to give the .proto file for class Person and get the above output in return. I do NOT want to do manual work. I can write that tool myself. But if there is already a tool that is widely used, I would prefer to use that one instead of reinventing the wheel.
There is a C# protobuf generator here:
https://code.google.com/p/protobuf-csharp-port/wiki/ProtoGen
It can take protobin output from protoc.exe, or it can take .proto files and transparently call protoc for you, then converts the output to C#. It is open source so if you need to tweak how it generates classes, you can.