handoutz / protobuf-net

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

Does protogen.exe support options of protobuf messages? #156

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I use protogen.exe to generate .cs files from .proto files, but the options are 
missing, eg.

message MyMessage {
    option (my_option) = ...;
}

I can not see my_option in the generated .cs file.Has this feature been 
implemented? If so, how to enable it?
thx.

Original issue reported on code.google.com by cometl...@gmail.com on 12 Feb 2011 at 1:38

GoogleCodeExporter commented 9 years ago
Not currenty. This could potentially be done via clr attributes, but it isn't 
something I've looked at hugely. Do you have a specific scenario in mind?

Original comment by marc.gravell on 12 Feb 2011 at 9:09

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I'm working on a cross-language project, we intended to serialize/deserialize 
via the typeid specified in the option. eg:
message MyMessage {
    option (type_id) = 37;
    ...
}
when the message being sent, the type_id is automatically written to the 
package header,which can help the remote receiver deserialize it.Is there any 
better option?

Original comment by cometl...@gmail.com on 14 Feb 2011 at 11:05

GoogleCodeExporter commented 9 years ago
Hey Marc, I'm currently running head-long into this issue, and was wondering if 
you'd rethunk your stance on adding support for option in protobuf.net - 
alternatively, was wondering what approach you might have in mind for it (and 
whether you'd be willing to accept an outside patch to add support?)

Original comment by jerkimb...@gmail.com on 21 Mar 2013 at 2:55

GoogleCodeExporter commented 9 years ago
(more context) Specifically, I'm in almost the exact same scenario: a common 
imported proto file that extends to include an optional "message type id", 
which is set in each actual message proto file via "option 
(foo.message_type_id) = 42;"

Original comment by jerkimb...@gmail.com on 21 Mar 2013 at 3:22