Hello,

I have two classes:

        [DataContract]
        public class TestClass: Base<TestClass>
        {
                [DataMember(Order = 1)]
                public string Str { get; set; }
        }

        [DataContract]
        [ProtoInclude(1,typeof(TestClass))]
        public class Base<T>
        {
                [DataMember]
                public T ReturnType { get; set; }
        }

I know, that I must use ProtoInclude attribute to allow serialization.

Problem is, that I have about 100 classes that inherit from Base
class, and I should write 100 attributes.
Is any possibility to add this information not using Attribute on
class but programmatically?

In DataContractSerializerOperationBehavior when you override method
CreateSerializer you may write code to add your own list of known
types.

But.. ProtoInclude has not only information about type but also tag.


can anyone help?

Bartosz Pierzchlewicz

--

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.


Reply via email to