0

Working with objects in protobuf-net, I create, with our code generator, simple POCOS with [ProtoContract] - [ProtoMember(..)]. What I should do with Composite objects, where every simple object has its protobuf-annotation ? e.g

    [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;}
    }

is this correct ?

thank you.

4

0 回答 0