@@ -17,26 +17,18 @@ public partial class LoginViewModel
1717 }
1818
1919 [ GenerateSerialize , GenerateDeserialize ]
20- [ MessagePackObject ]
20+ [ MessagePackObject ( keyAsPropertyName : true ) ]
21+ [ SerdeTypeOptions ( MemberFormat = MemberFormat . None ) ]
2122 public partial record Location
2223 {
23- [ Key ( 0 ) ]
2424 public int Id { get ; set ; }
25- [ Key ( 1 ) ]
2625 public string Address1 { get ; set ; }
27- [ Key ( 2 ) ]
2826 public string Address2 { get ; set ; }
29- [ Key ( 3 ) ]
3027 public string City { get ; set ; }
31- [ Key ( 4 ) ]
3228 public string State { get ; set ; }
33- [ Key ( 5 ) ]
3429 public string PostalCode { get ; set ; }
35- [ Key ( 6 ) ]
3630 public string Name { get ; set ; }
37- [ Key ( 7 ) ]
3831 public string PhoneNumber { get ; set ; }
39- [ Key ( 8 ) ]
4032 public string Country { get ; set ; }
4133
4234 public static Location Sample => new Location
@@ -52,110 +44,4 @@ public partial record Location
5244 Country = "The Greatest"
5345 } ;
5446 }
55-
56- public sealed partial class LocationWrap : IDeserialize < Location > , IDeserializeProvider < Location >
57- {
58- public static LocationWrap Instance { get ; } = new ( ) ;
59- static IDeserialize < Location > IDeserializeProvider < Location > . DeserializeInstance => Instance ;
60- private LocationWrap ( ) { }
61-
62- public static ISerdeInfo SerdeInfo { get ; } = Serde . SerdeInfo . MakeCustom (
63- "Location" ,
64- typeof ( Location ) . GetCustomAttributesData ( ) ,
65- [
66- ( "id" , Int32Proxy . SerdeInfo , typeof ( Location ) . GetProperty ( "Id" ) ! ) ,
67- ( "address1" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "Address1" ) ! ) ,
68- ( "address2" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "Address2" ) ! ) ,
69- ( "city" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "City" ) ! ) ,
70- ( "state" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "State" ) ! ) ,
71- ( "postalCode" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "PostalCode" ) ! ) ,
72- ( "name" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "Name" ) ! ) ,
73- ( "phoneNumber" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "PhoneNumber" ) ! ) ,
74- ( "country" , StringProxy . SerdeInfo , typeof ( Location ) . GetProperty ( "Country" ) ! )
75- ] ) ;
76-
77- Benchmarks . Location Serde . IDeserialize < Benchmarks . Location > . Deserialize ( IDeserializer deserializer )
78- {
79- int _l_id = default ! ;
80- string _l_address1 = default ! ;
81- string _l_address2 = default ! ;
82- string _l_city = default ! ;
83- string _l_state = default ! ;
84- string _l_postalcode = default ! ;
85- string _l_name = default ! ;
86- string _l_phonenumber = default ! ;
87- string _l_country = default ! ;
88- ushort _r_assignedValid = 0b0 ;
89-
90- var _l_serdeInfo = SerdeInfo ;
91- var typeDeserialize = deserializer . ReadType ( _l_serdeInfo ) ;
92- int index ;
93- while ( ( index = typeDeserialize . TryReadIndex ( _l_serdeInfo , out _ ) ) != IDeserializeType . EndOfType )
94- {
95- switch ( index )
96- {
97- case 0 :
98- _l_id = typeDeserialize . ReadI32 ( index ) ;
99- _r_assignedValid |= ( ( ushort ) 1 ) << 0 ;
100- break ;
101- case 1 :
102- _l_address1 = typeDeserialize . ReadString ( index ) ;
103- _r_assignedValid |= ( ( ushort ) 1 ) << 1 ;
104- break ;
105- case 2 :
106- _l_address2 = typeDeserialize . ReadString ( index ) ;
107- _r_assignedValid |= ( ( ushort ) 1 ) << 2 ;
108- break ;
109- case 3 :
110- _l_city = typeDeserialize . ReadString ( index ) ;
111- _r_assignedValid |= ( ( ushort ) 1 ) << 3 ;
112- break ;
113- case 4 :
114- _l_state = typeDeserialize . ReadString ( index ) ;
115- _r_assignedValid |= ( ( ushort ) 1 ) << 4 ;
116- break ;
117- case 5 :
118- _l_postalcode = typeDeserialize . ReadString ( index ) ;
119- _r_assignedValid |= ( ( ushort ) 1 ) << 5 ;
120- break ;
121- case 6 :
122- _l_name = typeDeserialize . ReadString ( index ) ;
123- _r_assignedValid |= ( ( ushort ) 1 ) << 6 ;
124- break ;
125- case 7 :
126- _l_phonenumber = typeDeserialize . ReadString ( index ) ;
127- _r_assignedValid |= ( ( ushort ) 1 ) << 7 ;
128- break ;
129- case 8 :
130- _l_country = typeDeserialize . ReadString ( index ) ;
131- _r_assignedValid |= ( ( ushort ) 1 ) << 8 ;
132- break ;
133- case Serde . IDeserializeType . IndexNotFound :
134- typeDeserialize . SkipValue ( ) ;
135- break ;
136- default :
137- throw new InvalidOperationException ( "Unexpected index: " + index ) ;
138- }
139- }
140-
141- if ( _r_assignedValid != 0b111111111 )
142- {
143- throw Serde . DeserializeException . UnassignedMember ( ) ;
144- }
145-
146- var newType = new Benchmarks . Location ( )
147- {
148- Id = _l_id ,
149- Address1 = _l_address1 ,
150- Address2 = _l_address2 ,
151- City = _l_city ,
152- State = _l_state ,
153- PostalCode = _l_postalcode ,
154- Name = _l_name ,
155- PhoneNumber = _l_phonenumber ,
156- Country = _l_country ,
157- } ;
158- return newType ;
159- }
160- }
16147}
0 commit comments