-
Notifications
You must be signed in to change notification settings - Fork 932
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
tohidemyname
committed
Jun 29, 2024
1 parent
7ed5bc8
commit 686abf1
Showing
5 changed files
with
165 additions
and
0 deletions.
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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NHNewBug | ||
{ | ||
public class Child | ||
{ | ||
private int id; | ||
public virtual int Id | ||
{ | ||
get { return id; } | ||
set { id = value; } | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/NHibernate.Test/NHSpecificTest/NHNewBug/ContainedChild.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,35 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using NHibernate.UserTypes; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NHNewBug | ||
{ | ||
public class ContainedChild | ||
{ | ||
private int id; | ||
public virtual int Id | ||
{ | ||
get { return id; } | ||
set { id = value; } | ||
} | ||
private Child child; | ||
|
||
public ContainedChild() | ||
{ | ||
} | ||
|
||
public ContainedChild(Child child) | ||
{ | ||
this.child = child; | ||
} | ||
|
||
public virtual Child Child | ||
{ | ||
get { return child; } | ||
set { child = value; } | ||
} | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/NHibernate.Test/NHSpecificTest/NHNewBug/ManyToOneFixture.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,49 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using NUnit.Framework; | ||
|
||
/* 项目“NHibernate.Test (net48)”的未合并的更改 | ||
在此之前: | ||
using NHibernate.Test.NHSpecificTest; | ||
在此之后: | ||
using NHibernate.Test.NHSpecificTest; | ||
using NHibernate; | ||
using NHibernate.Test; | ||
using NHibernate.Test.MappingTest; | ||
using NHibernate.Test.NHSpecificTest.NHNewBug; | ||
*/ | ||
using NHibernate.Test.NHSpecificTest; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NHNewBug | ||
{ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
[TestFixture] | ||
internal class ManyToOneFixture : BugTestCase | ||
{ | ||
[Test] | ||
public void AccessIdOfManyToOneInEmbeddable() | ||
{ | ||
ISession s = OpenSession(); | ||
ITransaction t = s.BeginTransaction(); | ||
Parent p = new Parent(); | ||
p.ContainedChildren.Add(new ContainedChild(new Child())); | ||
s.Persist(p); | ||
t.Commit(); | ||
var list = s.CreateQuery("from Parent p join p.ContainedChildren c where c.Child.Id is not null").List(); | ||
Assert.AreNotEqual(0, list.Count); | ||
s.Delete(p); | ||
t.Commit(); | ||
s.Close(); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/NHibernate.Test/NHSpecificTest/NHNewBug/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,31 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" | ||
assembly="NHibernate.Test" | ||
namespace="NHibernate.Test.NHSpecificTest.NHNewBug"> | ||
|
||
<class name="Child"> | ||
<id name="Id"> | ||
<generator class="native" /> | ||
</id> | ||
</class> | ||
|
||
<class name="ContainedChild"> | ||
<id name="Id"> | ||
<generator class="native" /> | ||
</id> | ||
<many-to-one name="Child" cascade="all" not-null="true" /> | ||
</class> | ||
|
||
<class name="Parent"> | ||
<id name="Id"> | ||
<generator class="native"/> | ||
</id> | ||
<many-to-one name="ContainedChild" cascade="all" /> | ||
<set name="ContainedChildren" inverse="true" cascade="all"> | ||
<key column="Parent" /> | ||
<one-to-many class="ContainedChild" /> | ||
</set> | ||
</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,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace NHibernate.Test.NHSpecificTest.NHNewBug | ||
{ | ||
public class Parent | ||
{ | ||
private int id; | ||
private ContainedChild containedChild; | ||
private ISet<ContainedChild> containedChildren = new HashSet<ContainedChild>(); | ||
|
||
public virtual int Id | ||
{ | ||
get { return id; } | ||
set { id = value; } | ||
} | ||
|
||
public virtual ContainedChild ContainedChild | ||
{ | ||
get { return containedChild; } | ||
set { containedChild = value; } | ||
} | ||
public virtual ISet<ContainedChild> ContainedChildren | ||
{ | ||
get { return containedChildren; } | ||
set { containedChildren = value; } | ||
} | ||
} | ||
} |