-
Notifications
You must be signed in to change notification settings - Fork 933
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Roman Artiukhin <[email protected]>
- Loading branch information
1 parent
a966226
commit 39a28aa
Showing
15 changed files
with
231 additions
and
7 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
src/NHibernate.Test/Async/NHSpecificTest/GH2608/Fixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by AsyncGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
|
||
using NUnit.Framework; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.GH2608 | ||
{ | ||
using System.Threading.Tasks; | ||
[TestFixture] | ||
public class FixtureAsync : BugTestCase | ||
{ | ||
protected override void OnTearDown() | ||
{ | ||
using (var session = OpenSession()) | ||
using (var transaction = session.BeginTransaction()) | ||
{ | ||
session.CreateQuery("delete from PersonalDetails").ExecuteUpdate(); | ||
session.CreateQuery("delete from System.Object").ExecuteUpdate(); | ||
|
||
transaction.Commit(); | ||
} | ||
} | ||
|
||
[Test] | ||
public async Task MergeBidiPrimaryKeyOneToOneAsync() | ||
{ | ||
using (var s = OpenSession()) | ||
using (var tx = s.BeginTransaction()) | ||
{ | ||
var p = new Person { Name = "steve" }; | ||
p.Details = new PersonalDetails { SomePersonalDetail = "I have big feet", Person = p }; | ||
await (s.MergeAsync(p)); | ||
await (tx.CommitAsync()); | ||
} | ||
} | ||
|
||
[Test] | ||
public async Task PersistBidiPrimaryKeyOneToOneAsync() | ||
{ | ||
using (var s = OpenSession()) | ||
using (var tx = s.BeginTransaction()) | ||
{ | ||
var p = new Person { Name = "steve" }; | ||
p.Details = new PersonalDetails { SomePersonalDetail = "I have big feet", Person = p }; | ||
await (s.PersistAsync(p)); | ||
await (tx.CommitAsync()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using NUnit.Framework; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.GH2608 | ||
{ | ||
[TestFixture] | ||
public class Fixture : BugTestCase | ||
{ | ||
protected override void OnTearDown() | ||
{ | ||
using (var session = OpenSession()) | ||
using (var transaction = session.BeginTransaction()) | ||
{ | ||
session.CreateQuery("delete from PersonalDetails").ExecuteUpdate(); | ||
session.CreateQuery("delete from System.Object").ExecuteUpdate(); | ||
|
||
transaction.Commit(); | ||
} | ||
} | ||
|
||
[Test] | ||
public void MergeBidiPrimaryKeyOneToOne() | ||
{ | ||
using (var s = OpenSession()) | ||
using (var tx = s.BeginTransaction()) | ||
{ | ||
var p = new Person { Name = "steve" }; | ||
p.Details = new PersonalDetails { SomePersonalDetail = "I have big feet", Person = p }; | ||
s.Merge(p); | ||
tx.Commit(); | ||
} | ||
} | ||
|
||
[Test] | ||
public void PersistBidiPrimaryKeyOneToOne() | ||
{ | ||
using (var s = OpenSession()) | ||
using (var tx = s.BeginTransaction()) | ||
{ | ||
var p = new Person { Name = "steve" }; | ||
p.Details = new PersonalDetails { SomePersonalDetail = "I have big feet", Person = p }; | ||
s.Persist(p); | ||
tx.Commit(); | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/NHibernate.Test/NHSpecificTest/GH2608/Mappings.hbm.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" | ||
assembly="NHibernate.Test" | ||
namespace="NHibernate.Test.NHSpecificTest.GH2608"> | ||
|
||
<class name="Person"> | ||
<id name="Id"> | ||
<generator class="native"/> | ||
</id> | ||
<property name="Name"/> | ||
<one-to-one name="Details" class="PersonalDetails" cascade="all"/> | ||
</class> | ||
|
||
<class name="PersonalDetails"> | ||
<id name="Id"> | ||
<generator class="foreign"> | ||
<param name="property">Person</param> | ||
</generator> | ||
</id> | ||
<property name="SomePersonalDetail"/> | ||
<one-to-one name="Person" class="Person" constrained="true"/> | ||
</class> | ||
|
||
</hibernate-mapping> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace NHibernate.Test.NHSpecificTest.GH2608 | ||
{ | ||
public class Person | ||
{ | ||
public virtual long Id { get; set; } | ||
public virtual string Name { get; set; } | ||
public virtual PersonalDetails Details { get; set; } | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/NHibernate.Test/NHSpecificTest/GH2608/PersonalDetails.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace NHibernate.Test.NHSpecificTest.GH2608 | ||
{ | ||
public class PersonalDetails | ||
{ | ||
public virtual long Id { get; set; } | ||
public virtual string SomePersonalDetail { get; set; } | ||
|
||
public virtual Person Person { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters