leejw51 / protobuf-net

Automatically exported from code.google.com/p/protobuf-net
0 stars 0 forks source link

Serializer.GetProto should support converting C# names to Protobuf naming convention #107

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
C# naming convention mostly uses Pascal case. By contrast, Protocol Buffers 
require an underscore-separated lower case pattern for most identifiers. 
For enum values, upper case is used.

The file generated by Serializer.GetProto makes use of existing names, 
which causes protoc.exe to generate completely unreadable C++ client code.

Note that I use DataContract/DataMember/EnumMember attributes. I wouldn't 
want to override names for each property (I have many dozens of them). As 
for enums, I beliebe controlling the name is downright impossible with the 
current implementation (282) of Protobuf, unless I resort to using Protobuf 
attributes.

The ideal solution would be an option to enable automatic conversion of 
names from Pascal Case to protobuf naming convention. If that's difficult, 
I would just like a callback for each name, and I will implement the name 
conversion myself.

Thanks!

(And in general, thanks for your brilliant product!)

Original issue reported on code.google.com by lev.ko...@gmail.com on 16 May 2010 at 5:14

GoogleCodeExporter commented 9 years ago
I haven't yet started GetProto for the new "v2" release, so I will add this to 
the plan 
for "v2". Good feedback.

Original comment by marc.gravell on 16 May 2010 at 6:15