-
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.
NH-3985 - Fix for subsequent child sessions being returned in dispose…
…d state
- Loading branch information
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
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 @@ | ||
using System; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NH3985 | ||
{ | ||
public partial class Process | ||
{ | ||
public virtual Guid ProcessID { get; set; } | ||
public virtual string Name { 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using NUnit.Framework; | ||
using System; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NH3985 | ||
{ | ||
/// <summary> | ||
/// The test verifies that subsequent child sessions are not issued in already-disposed state. | ||
/// </summary> | ||
[TestFixture] | ||
public class Fixture : BugTestCase | ||
{ | ||
[Test] | ||
public void GetChildSession_ShouldReturnNonDisposedInstance() | ||
{ | ||
using (var rootSession = OpenSession()) | ||
{ | ||
using (var childSession1 = rootSession.GetChildSession()) | ||
{ | ||
} | ||
|
||
using (var childSession2 = rootSession.GetChildSession()) | ||
{ | ||
Assert.DoesNotThrow(() => { childSession2.Get<Process>(Guid.NewGuid()); }); | ||
} | ||
} | ||
} | ||
|
||
[Test] | ||
public void GetChildSession_ShouldReturnNonClosedInstance() | ||
{ | ||
using (var rootSession = OpenSession()) | ||
{ | ||
var childSession1 = rootSession.GetChildSession(); | ||
childSession1.Close(); | ||
|
||
using (var childSession2 = rootSession.GetChildSession()) | ||
{ | ||
Assert.DoesNotThrow(() => { childSession2.Get<Process>(Guid.NewGuid()); }); | ||
} | ||
} | ||
} | ||
} | ||
} |
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.Test" namespace="NHibernate.Test.NHSpecificTest.NH3985"> | ||
<class name="Process"> | ||
<id name="ProcessID" generator="guid.comb" /> | ||
<property name="Name" /> | ||
</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
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