Skip to content

Commit 4431485

Browse files
committed
Add tests for NH-2783
1 parent 2345bb4 commit 4431485

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System.Collections.Generic;
2+
3+
namespace NHibernate.Test.NHSpecificTest.NH2783
4+
{
5+
class Bar
6+
{
7+
public virtual int Id { get; set; }
8+
9+
public virtual int DynValString2 { get; set; }
10+
11+
public virtual IDictionary<string, object> MyProps { get; set; } = new Dictionary<string, object>();
12+
}
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using NUnit.Framework;
2+
3+
namespace NHibernate.Test.NHSpecificTest.NH2783
4+
{
5+
[TestFixture]
6+
public class Fixture : BugTestCase
7+
{
8+
protected override void OnSetUp()
9+
{
10+
}
11+
12+
protected override void OnTearDown()
13+
{
14+
using (var session = OpenSession())
15+
using (var transaction = session.BeginTransaction())
16+
{
17+
// The HQL delete does all the job inside the database without loading the entities, but it does
18+
// not handle delete order for avoiding violating constraints if any. Use
19+
// session.Delete("from System.Object");
20+
// instead if in need of having NHbernate ordering the deletes, but this will cause
21+
// loading the entities in the session.
22+
session.CreateQuery("delete from System.Object").ExecuteUpdate();
23+
24+
transaction.Commit();
25+
}
26+
}
27+
28+
[Test]
29+
public void DoNothing()
30+
{
31+
}
32+
}
33+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System.Collections.Generic;
2+
3+
namespace NHibernate.Test.NHSpecificTest.NH2783
4+
{
5+
class Foo
6+
{
7+
public virtual int Id { get; set; }
8+
9+
public virtual IDictionary<string, object> MyProps { get; set; } = new Dictionary<string, object>();
10+
}
11+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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.NH2783">
5+
6+
<class name="Foo">
7+
<id type="int" name="Id">
8+
<column name="Id"/>
9+
<generator class="native"/>
10+
</id>
11+
12+
<dynamic-component name="MyProps">
13+
<many-to-one name="DynPointer" class="Bar" property-ref="MyProps.DynValString2"/>
14+
</dynamic-component>
15+
</class>
16+
17+
<class name="Bar">
18+
<id type="int" name="Id">
19+
<column name="Id"/>
20+
<generator class="native"/>
21+
</id>
22+
<dynamic-component name="MyProps">
23+
<property name="DynValString2" type="string" unique="1"/>
24+
</dynamic-component>
25+
</class>
26+
</hibernate-mapping>

0 commit comments

Comments
 (0)