Protobuf-net Inheritance & Field Numbers

I am trying to build a serialization system for our application, which should be able to handle inheritance. To further complicate matters, the application is extensible, so types may be unlikely at compile time.

I read the previous stacking question that was answered, and it helped me go a long way towards my goal, but I hit a stumbling block, which is probably more of a lack of understanding than any real problem!

So this is the code that I currently have ...

public interface IBaseFrame
{

}

public class BasicDataFrame : IBaseFrame
{

}

public class AnotherFrame : BasicDataFrame
{

}

. ,,.

RuntimeTypeModel model = TypeModel.Create();
MetaType baseType = model.Add(typeof(IBaseFrame), true);
MetaType basicFrameType = model.Add(typeof(BasicDataFrame),true);

baseType.AddSubType(7, typeof(BasicDataFrame));
model.Add(typeof(AnotherFrame), true);

basicFrameType.AddSubType(8, typeof(AnotherFrame));

( !), ... , 7 8 fieldNumber AddSubType.

, SerialisationManager, fieldNumber ( , ).

, ( ) , , ( , , ) , .

- ,

, , !

+1
1

; , , , , . , . .

+2

All Articles