11//using DemoClientV4.ODataDemo;
2- using DemoClientV4 . ODataDemo ;
2+ // using DemoClientV4.ODataDemo;
33using Linq2OData . Core . Metadata ;
44using Linq2OData . Generator . Models ;
55
@@ -17,14 +17,15 @@ static async Task Main(string[] args)
1717 {
1818 Console . WriteLine ( "Here we go!" ) ;
1919
20- //await GenerateDemoClientV2Async();
20+ // await GenerateDemoClientV2Async();
2121 //await GenerateDemoClientV4Async();
2222 //await GenerateTripPinClientAsync();
2323
2424 //GenerateLargeClientAsync();
2525
26- // await TestTripPinAsync();
27- await TestV4ClientAsync ( ) ;
26+ // await TestTripPinAsync();
27+ //await TestV4ClientAsync();
28+ await TestV2ClientAsync ( ) ;
2829 }
2930
3031 private static async Task TestTripPinAsync ( )
@@ -90,11 +91,17 @@ private static async Task TestV2ClientAsync()
9091
9192 var kalle = clientV2 . Services ;
9293
93- var queryResult = await clientV2
94- . Query < DemoClientV2 . ODataDemo . Product > ( )
95- . Filter ( e => e . ID != 1 )
96- . Expand ( expand => expand . Category ! . Products )
97- . ExecuteAsync ( ) ;
94+ //var queryResult = await clientV2
95+ // .Query<DemoClientV2.ODataDemo.Product>()
96+ // .Filter(e => e.ID != 1)
97+ // .Select(e => e.Select(e => new DemoClientV2.ODataDemo.Product { Name = e.Name, Price = e.Price, Supplier = new DemoClientV2.ODataDemo.Supplier { Name = e.Name } }))
98+ // .ExecuteAsync();
99+
100+ var query = clientV2
101+ . Query < DemoClientV2 . ODataDemo . Supplier > ( )
102+ . Select ( e => e . Select ( e => new DemoClientV2 . ODataDemo . Supplier { Name = e . Name , Products = e . Products ! . Select ( p => new DemoClientV2 . ODataDemo . Product { Name = p . Name } ) . ToList ( ) } ) ) ;
103+
104+ var queryResult = await query . ExecuteAsync ( ) ;
98105
99106
100107 var r = queryResult ;
@@ -112,7 +119,7 @@ private static async Task TestV4ClientAsync()
112119 var clientV4 = new DemoClientV4 . ODataDemoClientV4 ( httpClient ) ;
113120
114121 var queryResult = await clientV4
115- . Get < Product > ( e => e . ID = 4 )
122+ . Get < DemoClientV4 . ODataDemo . Product > ( e => e . ID = 4 )
116123 . Expand ( e => e . Categories )
117124 . Expand ( e => e . Supplier )
118125 . ExecuteAsync ( ) ;
@@ -185,7 +192,7 @@ private static async Task GenerateTripPinClientAsync()
185192
186193 private static void GenerateLargeClientAsync ( )
187194 {
188-
195+
189196 var metadata = File . ReadAllText ( "Metadata/LargeMetadata.xml" ) ;
190197
191198
@@ -212,8 +219,8 @@ private static void GenerateLargeClientAsync()
212219
213220 var files = generator . GenerateClient ( Path . Combine ( projectDirectory , "LargeClientV4" ) ) ;
214221
215- // var files = generator.GenerateClient();
216-
222+ // var files = generator.GenerateClient();
223+
217224 }
218225
219226
0 commit comments