private static void Merge(ref ProtoReader.State state, ref protogen.OrderLine obj)
        {
            int field;

            if (obj == null)
            {
                obj = new protogen.OrderLine();
            }
            while ((field = state.ReadFieldHeader()) != 0)
            {
                switch (field)
                {
                case 1:
                    obj.OrderID = state.ReadInt32();
                    break;

                case 2:
                    obj.ProductID = state.ReadInt32();
                    break;

                case 3:
                    obj.UnitPrice = state.ReadDouble();
                    break;

                case 4:
                    state.Hint(WireType.SignedVarint);
                    obj.Quantity = state.ReadInt32();
                    break;

                case 5:
                    obj.Discount = state.ReadSingle();
                    break;

                default:
                    state.AppendExtensionData(obj);
                    break;
                }
            }
        }
        private static void Merge(ref ProtoReader.State state, ref protogen.Order obj)
        {
            SubItemToken tok;
            int          field;

            if (obj == null)
            {
                obj = new protogen.Order();
            }
            while ((field = state.ReadFieldHeader()) != 0)
            {
                switch (field)
                {
                case 1:
                    obj.OrderID = state.ReadInt32();
                    break;

                case 2:
                    obj.CustomerID = state.ReadString();
                    break;

                case 3:
                    obj.EmployeeID = state.ReadInt32();
                    break;

                case 4:
                    obj.OrderDate = BclHelpers.ReadTimestamp(ref state);
                    break;

                case 5:
                    obj.RequiredDate = BclHelpers.ReadTimestamp(ref state);
                    break;

                case 6:
                    obj.ShippedDate = BclHelpers.ReadTimestamp(ref state);
                    break;

                case 7:
                    obj.ShipVia = state.ReadInt32();
                    break;

                case 8:
                    obj.Freight = state.ReadDouble();
                    break;

                case 9:
                    obj.ShipName = state.ReadString();
                    break;

                case 10:
                    obj.ShipAddress = state.ReadString();
                    break;

                case 11:
                    obj.ShipCity = state.ReadString();
                    break;

                case 12:
                    obj.ShipRegion = state.ReadString();
                    break;

                case 13:
                    obj.ShipPostalCode = state.ReadString();
                    break;

                case 14:
                    obj.ShipCountry = state.ReadString();
                    break;

                case 15:
                    do
                    {
                        protogen.OrderLine _15 = default;
                        tok = state.StartSubItem();
                        Merge(ref state, ref _15);
                        state.EndSubItem(tok);
                        obj.Lines.Add(_15);
                    } while (state.TryReadFieldHeader(1));
                    break;

                default:
                    state.AppendExtensionData(obj);
                    break;
                }
            }
        }
Beispiel #3
0
 public object Read(ref ProtoReader.State state, object value)
 {
     Debug.Assert(value == null); // since replaces
     return(state.ReadDouble());
 }