复合对象中的Protobuf-net注释

时间:2013-03-29 10:31:44

标签: protobuf-net

使用protobuf-net中的对象,我使用我们的代码生成器创建了带有[ProtoContract] - [ProtoMember(..)]的简单POCOS。 我应该如何处理Composite对象,其中每个简单对象都有protobuf-annotation? 例如

    [ProtoContract]
   [ProtoInclude(1, typeof(RetailCustomer)]
    public class Customer
    {
      [ProtoMember(1)]
      public string Name {get;set;}
      [ProtoMember(...)] ..
    }

   [ProtoContract]     
    public class RetailCustomer:Customer
    {

      [ProtoMember(1)]
      public string Demographics {get;set;}
      bool Is Active;
    }

    [ProtoContract]
    public class Order
    {
      [ProtoMember(1)]
      public string Order_No {get;set;}
      [ProtoMember(...)] ..
    }

    How to handle the following ?   
    [ProtoContract]
    public class CustomerOrders
    {
      [ProtoMember(1)]
      public  RetailCustomer customer {get;set;}
      [ProtoMember(2)]
      public  List<Order>  Orders {get;set;}
     [ProtoMember(3)]
      public  int Year   {get;set;}
    }

这是对的吗?

谢谢。

0 个答案:

没有答案