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 1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
3
4
namespace NHibernate . Test . NHSpecificTest . NH3951
4
5
{
5
6
class Entity
6
7
{
7
8
public virtual Guid Id { get ; set ; }
8
9
public virtual string Name { get ; set ; }
10
+ public virtual Guid ? RelatedId { get ; set ; }
11
+
12
+ public virtual ISet < Entity > Related { get ; set ; }
9
13
}
10
14
}
Original file line number Diff line number Diff line change @@ -86,5 +86,20 @@ public void AllNamedWithAtLeast3CharWorkaround()
86
86
Assert . AreEqual ( true , result ) ;
87
87
}
88
88
}
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
+ }
89
104
}
90
105
}
Original file line number Diff line number Diff line change 4
4
<class name =" Entity" >
5
5
<id name =" Id" generator =" guid.comb" />
6
6
<property name =" Name" />
7
+ <property name =" RelatedId" />
8
+ <set name =" Related" >
9
+ <key column =" RelatedId" />
10
+ <one-to-many class =" Entity" />
11
+ </set >
7
12
</class >
8
13
9
14
</hibernate-mapping >
You can’t perform that action at this time.
0 commit comments