I have read many questions about inheritance feature in protobuf-net. I just wonder that if I can use [DataContract],[DataMember] in the same way of using [ProtoContract],[ProtoMember]. Why I could not use [KnowType] instead of using [ProtoInclude]?
I raise this question because I used [DataContract],[DataMember] for protobuf-net's serialization already. There was no need to add "Protobuf-net". It used only "System.Runtime.Serialization".
But... Now if my class need to inherit from some class, do I have to add "Protobuf-net" for [ProtoInclude] attribute? for example,
using System.Runtime.Serialization;
namespace test
{
[DataContract]
/// [KnowType(typeof(SomeClass))]
/// or
/// [ProtoInclude(100,typeof(SomeClass))]
public class BaseClass
{
//...
[DataMember(Order=1)]
public string BlahBlahBlah {get; set;}
}
[DataContract]
public class ChildClass1 : BaseClass
{
//...
[DataMember(Order=1)]
public string BlahBlahBlah {get; set;}
}
}// end namespace
finally, I wonder if I have 100 child class, Won't I drive myself crazy adding 100 [ProtoInclude] tags inside base class?
Thx in adv for any help
vee