In C# we have namespaces in .proto we get from protobuf-net we do not get any namespaces. So the question is how to make protobuf-net generate (and use inside) .proto files with namespacs/packages.
Example when we parsed all our project to make .proto files to connect a C++ app to our C# app we got tons of
enum AnimationCode {
None = 0;
Idle = 1;
//...
}
and
enum SessionCode {
None = 0;
//...
}
And so when we gave that unified project .proto file to protogen compiler we got tons of
Enum type “SessionStateCode” has no value named “None”.
and
Note that enum values use C++ scoping rules, meaning that enum values
are siblings of their type, not children of it.
and no C++ code.
Point was to make it so that encoded C# message would be at least readable from C++
There is not currently any code inside protobuf-net to perform automatic name collision fixes, although I’d be interested to know if you have any proposals. Another option would be:
Here, the .proto will use
AnimationCode_Nonewhen generation the scema; in fact, it will be:I’ve checked the
MetaType/ValueMemberAPI, and it looks like currently it would be hard to set the.Nameat runtime, but that could be fixed in a new release easily enough (like with this similar enum/MetaTypefix) if you preferred to set them at runtime rather than decorate with attributes.