问题
I have a .net application that serializes using protobuf, and I wanted to create a python client that can communicate with it. Since my object graph is quite complex (and I am lazy busy) I wanted to quickly generate the .proto files directly from the C# classes like this:
string proto = Serializer.GetProto<YourType>();
Unfortunately this method is throwing a not implemented exception for me :'(
I am using the Dec 11 version
Has this feature been dropped? Is there a newer version I should be using? Or failing that, can anyone recommend an older version of it that I can temporarily use to create the .proto files?
Thanks <333
回答1:
This was re-implemented quite a while ago now; it is certainly available in r580 and higher.
Not dropped... Just not part of the core baseline that I absolutely needed to release v2. It is very much on my list to re-implement, but the type-model changed significantly between v1 and v2, necessitating a full rewrite of this code.
V1 is still available for download and should work in most reasonable cases. However, note that protobuf-net allows for more than the core specification - things like inheritance/generics don't have any meaning in .proto, and teen things like System.DateTime/System.Decimal need special handling. Basically, GetProto may get you most of the way there!
来源:https://stackoverflow.com/questions/9892910/protobuf-net-getprototype-method-throws-a-not-implemented-exception