@@ -359,8 +359,8 @@ public async Task CollectionQueryAsync()
359
359
if ( ! TestDialect . SupportsEmptyInsertsOrHasNonIdentityNativeGenerator )
360
360
Assert . Ignore ( "Support of empty inserts is required" ) ;
361
361
362
- ISession s = OpenSession ( ) ;
363
- ITransaction t = s . BeginTransaction ( ) ;
362
+ using var s = OpenSession ( ) ;
363
+ using var t = s . BeginTransaction ( ) ;
364
364
365
365
Simple s1 = new Simple ( ) ;
366
366
s1 . Name = "s" ;
@@ -383,10 +383,15 @@ public async Task CollectionQueryAsync()
383
383
l . Add ( null ) ;
384
384
l . Add ( s2 ) ;
385
385
c . ManyToMany = l ;
386
+ c . ManyToOne = new Simple { Name = "x" , Count = 4 } ;
387
+ await ( s . SaveAsync ( c . ManyToOne , c . ManyToOne . Count ) ) ;
386
388
await ( s . SaveAsync ( c ) ) ;
387
389
388
390
Assert . AreEqual ( 1 ,
389
391
( await ( s . CreateQuery ( "select c from c in class ContainerX, s in class Simple where c.OneToMany[2] = s" ) . ListAsync
392
+ ( ) ) ) . Count ) ;
393
+ Assert . AreEqual ( 1 ,
394
+ ( await ( s . CreateQuery ( "select c from c in class ContainerX, s in class Simple where c.OneToMany[2] = s and c.ManyToOne.Name = 'x'" ) . ListAsync
390
395
( ) ) ) . Count ) ;
391
396
Assert . AreEqual ( 1 ,
392
397
( await ( s . CreateQuery ( "select c from c in class ContainerX, s in class Simple where c.ManyToMany[2] = s" ) .
@@ -424,13 +429,13 @@ public async Task CollectionQueryAsync()
424
429
"select c from c in class ContainerX where c.ManyToMany[ c.OneToMany[0].Count ].Name = 's'" ) . ListAsync ( ) ) ) .
425
430
Count ) ;
426
431
432
+ await ( s . DeleteAsync ( c . ManyToOne ) ) ;
427
433
await ( s . DeleteAsync ( c ) ) ;
428
434
await ( s . DeleteAsync ( s1 ) ) ;
429
435
await ( s . DeleteAsync ( s2 ) ) ;
430
436
await ( s . DeleteAsync ( s3 ) ) ;
431
437
432
438
await ( t . CommitAsync ( ) ) ;
433
- s . Close ( ) ;
434
439
}
435
440
436
441
[ Test ]
0 commit comments