File tree Expand file tree Collapse file tree 3 files changed +70
-0
lines changed
src/NHibernate.Test/NHSpecificTest/GH1920 Expand file tree Collapse file tree 3 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace NHibernate . Test . NHSpecificTest . GH1920
4
+ {
5
+ public class EntityWithBatchSize
6
+ {
7
+ public virtual Guid Id { get ; set ; }
8
+ public virtual string Name { get ; set ; }
9
+ }
10
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using NUnit . Framework ;
3
+
4
+ namespace NHibernate . Test . NHSpecificTest . GH1920
5
+ {
6
+ [ TestFixture ]
7
+ public class Fixture : BugTestCase
8
+ {
9
+ private Guid entityId ;
10
+ private Guid someOtherEntityId ;
11
+
12
+ protected override void OnSetUp ( )
13
+ {
14
+ using ( var session = OpenSession ( ) )
15
+ using ( var transaction = session . BeginTransaction ( ) )
16
+ {
17
+ entityId = ( Guid ) session . Save ( new EntityWithBatchSize { Name = "some name" } ) ;
18
+ someOtherEntityId = ( Guid ) session . Save ( new EntityWithBatchSize ( ) ) ;
19
+
20
+ transaction . Commit ( ) ;
21
+ }
22
+ }
23
+
24
+ [ TestCase ( true ) ]
25
+ [ TestCase ( false ) ]
26
+ public void CanLoadEntity ( bool loadProxyOfOtherEntity )
27
+ {
28
+ using ( var session = OpenSession ( ) )
29
+ using ( session . BeginTransaction ( ) )
30
+ {
31
+ if ( loadProxyOfOtherEntity )
32
+ session . Load < EntityWithBatchSize > ( someOtherEntityId ) ;
33
+
34
+ var result = session . Get < EntityWithBatchSize > ( entityId ) ;
35
+
36
+ Assert . That ( result . Name , Is . Not . Null ) ;
37
+ }
38
+ }
39
+
40
+
41
+ protected override void OnTearDown ( )
42
+ {
43
+ using ( var session = OpenSession ( ) )
44
+ using ( var transaction = session . BeginTransaction ( ) )
45
+ {
46
+ session . CreateQuery ( "delete from EntityWithBatchSize" ) . ExecuteUpdate ( ) ;
47
+ transaction . Commit ( ) ;
48
+ }
49
+ }
50
+ }
51
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <hibernate-mapping xmlns =" urn:nhibernate-mapping-2.2" assembly =" NHibernate.Test"
3
+ namespace =" NHibernate.Test.NHSpecificTest.GH1920" >
4
+
5
+ <class name =" EntityWithBatchSize" batch-size =" 3" >
6
+ <id name =" Id" generator =" guid.comb" />
7
+ <property name =" Name" />
8
+ </class >
9
+ </hibernate-mapping >
You can’t perform that action at this time.
0 commit comments