This is specifically protobuf-net; firstly, you should be able to add -p:lightFramework to the command - that omits a few things that don't work on all frameworks, including [Serializable] iirc.
However, you can also just edit CSharp.xslt to make any necessary changes. Stick it alongside protogen.exe and it should be used automatically. Marc On 15 Jul 2014 21:01, "Neta Nir" <[email protected]> wrote: > Hello, > We are using Protogen in .Net environment. The auto generated class from > protgen is used as a response in a service contract between a wcf service > (http binding) and a browser client. WCF uses JSON serializer, the built > in. The problem we are having is that the c# Response class (which is auto > generated from protogen) is created with Properties, for example: > > > *[global::System.Serializable, > global::ProtoBuf.ProtoContract(Name = @"Response")]* > * public partial class Response : global::ProtoBuf.IExtensible* > * {* > * public Response() { } * > *private bool _success;* > * [global::ProtoBuf.ProtoMember(1, IsRequired = true, Name = > @"success", DataFormat = global::ProtoBuf.DataFormat.Default)]* > * public bool success* > * {* > * get { return _success; }* > * set { _success = value; }* > * }* > > This class is serialized by the WCF default json serializer and returned > to the client. The problem is that the json serialize output is composed > from the *private *member of the class and not from the public > properties, meaning that the browser response is returned in the following > way: > {_success:value} instead of {success:true}. > This is because of the [*System.Serializable*] tag on the class which is > makes all of the class *fields* serialized (no properties). > Is there a way to tell protogen to create the class with only public > fields and not properties? Any other suggestion will be welcome as well > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
