Пример #1
0
        private static void Merge(ProtoReader reader, ref ProtoReader.State state, ref protogen.Database obj)
        {
            SubItemToken tok;
            int          field;

            if (obj == null)
            {
                obj = new protogen.Database();
            }
            while ((field = reader.ReadFieldHeader(ref state)) != 0)
            {
                switch (field)
                {
                case 1:
                    do
                    {
                        protogen.Order _1 = default;
                        tok = ProtoReader.StartSubItem(reader, ref state);
                        Merge(reader, ref state, ref _1);
                        ProtoReader.EndSubItem(tok, reader, ref state);
                        obj.Orders.Add(_1);
                    } while (reader.TryReadFieldHeader(ref state, 1));
                    break;

                default:
                    reader.AppendExtensionData(ref state, obj);
                    break;
                }
            }
        }
Пример #2
0
        private static void Merge(ProtoReader reader, ref ProtoReader.State state, ref protogen.Order obj)
        {
            SubItemToken tok;
            int          field;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                default:
                    reader.AppendExtensionData(ref state, obj);
                    break;
                }
            }
        }