File tree Expand file tree Collapse file tree 5 files changed +120
-0
lines changed
Async/NHSpecificTest/GH2608 Expand file tree Collapse file tree 5 files changed +120
-0
lines changed Original file line number Diff line number Diff line change
1
+ //------------------------------------------------------------------------------
2
+ // <auto-generated>
3
+ // This code was generated by AsyncGenerator.
4
+ //
5
+ // Changes to this file may cause incorrect behavior and will be lost if
6
+ // the code is regenerated.
7
+ // </auto-generated>
8
+ //------------------------------------------------------------------------------
9
+
10
+
11
+ using NUnit . Framework ;
12
+
13
+ namespace NHibernate . Test . NHSpecificTest . GH2608
14
+ {
15
+ using System . Threading . Tasks ;
16
+ [ TestFixture ]
17
+ public class FixtureAsync : BugTestCase
18
+ {
19
+ protected override void OnTearDown ( )
20
+ {
21
+ using ( var session = OpenSession ( ) )
22
+ using ( var transaction = session . BeginTransaction ( ) )
23
+ {
24
+ session . CreateQuery ( "delete from PersonalDetails" ) . ExecuteUpdate ( ) ;
25
+ session . CreateQuery ( "delete from System.Object" ) . ExecuteUpdate ( ) ;
26
+
27
+ transaction . Commit ( ) ;
28
+ }
29
+ }
30
+
31
+ [ Test ]
32
+ public async Task MergeBidiPrimaryKeyOneToOneAsync ( )
33
+ {
34
+ using ( var s = OpenSession ( ) )
35
+ using ( var tx = s . BeginTransaction ( ) )
36
+ {
37
+ var p = new Person { Name = "steve" } ;
38
+ p . Details = new PersonalDetails { SomePersonalDetail = "I have big feet" , Person = p } ;
39
+ await ( s . MergeAsync ( p ) ) ;
40
+ await ( tx . CommitAsync ( ) ) ;
41
+ }
42
+ }
43
+ }
44
+ }
Original file line number Diff line number Diff line change
1
+ using NUnit . Framework ;
2
+
3
+ namespace NHibernate . Test . NHSpecificTest . GH2608
4
+ {
5
+ [ TestFixture ]
6
+ public class Fixture : BugTestCase
7
+ {
8
+ protected override void OnTearDown ( )
9
+ {
10
+ using ( var session = OpenSession ( ) )
11
+ using ( var transaction = session . BeginTransaction ( ) )
12
+ {
13
+ session . CreateQuery ( "delete from PersonalDetails" ) . ExecuteUpdate ( ) ;
14
+ session . CreateQuery ( "delete from System.Object" ) . ExecuteUpdate ( ) ;
15
+
16
+ transaction . Commit ( ) ;
17
+ }
18
+ }
19
+
20
+ [ Test ]
21
+ public void MergeBidiPrimaryKeyOneToOne ( )
22
+ {
23
+ using ( var s = OpenSession ( ) )
24
+ using ( var tx = s . BeginTransaction ( ) )
25
+ {
26
+ var p = new Person { Name = "steve" } ;
27
+ p . Details = new PersonalDetails { SomePersonalDetail = "I have big feet" , Person = p } ;
28
+ s . Merge ( p ) ;
29
+ tx . Commit ( ) ;
30
+ }
31
+ }
32
+ }
33
+ }
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"
3
+ assembly =" NHibernate.Test"
4
+ namespace =" NHibernate.Test.NHSpecificTest.GH2608" >
5
+
6
+ <class name =" Person" >
7
+ <id name =" Id" >
8
+ <generator class =" native" />
9
+ </id >
10
+ <property name =" Name" />
11
+ <one-to-one name =" Details" class =" PersonalDetails" cascade =" all" />
12
+ </class >
13
+
14
+ <class name =" PersonalDetails" >
15
+ <id name =" Id" >
16
+ <generator class =" foreign" >
17
+ <param name =" property" >Person</param >
18
+ </generator >
19
+ </id >
20
+ <property name =" SomePersonalDetail" />
21
+ <one-to-one name =" Person" class =" Person" constrained =" true" />
22
+ </class >
23
+
24
+ </hibernate-mapping >
Original file line number Diff line number Diff line change
1
+ namespace NHibernate . Test . NHSpecificTest . GH2608
2
+ {
3
+ public class Person
4
+ {
5
+ public virtual long Id { get ; set ; }
6
+ public virtual string Name { get ; set ; }
7
+ public virtual PersonalDetails Details { get ; set ; }
8
+ }
9
+ }
Original file line number Diff line number Diff line change
1
+ namespace NHibernate . Test . NHSpecificTest . GH2608
2
+ {
3
+ public class PersonalDetails
4
+ {
5
+ public virtual long Id { get ; set ; }
6
+ public virtual string SomePersonalDetail { get ; set ; }
7
+
8
+ public virtual Person Person { get ; set ; }
9
+ }
10
+ }
You can’t perform that action at this time.
0 commit comments