File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
src/NHibernate.Test/NHSpecificTest/NH3951 Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Generic ;
23
34namespace NHibernate . Test . NHSpecificTest . NH3951
45{
56 class Entity
67 {
78 public virtual Guid Id { get ; set ; }
89 public virtual string Name { get ; set ; }
10+ public virtual Guid ? RelatedId { get ; set ; }
11+
12+ public virtual ISet < Entity > Related { get ; set ; }
913 }
1014}
Original file line number Diff line number Diff line change @@ -86,5 +86,20 @@ public void AllNamedWithAtLeast3CharWorkaround()
8686 Assert . AreEqual ( true , result ) ;
8787 }
8888 }
89+
90+ [ Test ]
91+ public void AnyAndAllInSubQueries ( )
92+ {
93+ using ( ISession session = OpenSession ( ) )
94+ using ( session . BeginTransaction ( ) )
95+ {
96+ var result = session . Query < Entity > ( )
97+ . Select ( e => new { e . Id , hasRelated = e . Related . Any ( ) , allBobRelated = e . Related . All ( r => r . Name == "Bob" ) } )
98+ . ToList ( ) ;
99+
100+ Assert . AreEqual ( false , result [ 0 ] . hasRelated ) ;
101+ Assert . AreEqual ( true , result [ 0 ] . allBobRelated ) ;
102+ }
103+ }
89104 }
90105}
Original file line number Diff line number Diff line change 44 <class name =" Entity" >
55 <id name =" Id" generator =" guid.comb" />
66 <property name =" Name" />
7+ <property name =" RelatedId" />
8+ <set name =" Related" >
9+ <key column =" RelatedId" />
10+ <one-to-many class =" Entity" />
11+ </set >
712 </class >
813
914</hibernate-mapping >
You can’t perform that action at this time.
0 commit comments