Skip to content

Commit 2d2095b

Browse files
Merge pull request nhibernate#597 from fredericDelaporte/NH-3693
NH-3693 - AliasToBeanResultTransformer fails under Firebird
2 parents 6ae30d5 + 792186f commit 2d2095b

File tree

10 files changed

+527
-132
lines changed

10 files changed

+527
-132
lines changed

src/NHibernate.Test/Criteria/Lambda/LambdaFixtureBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ private void AssertObjectsAreEqual(object expected, object actual, string name)
128128

129129
if ((expectedType.IsValueType)
130130
|| (expected is System.Type)
131-
|| (expected is string))
131+
|| (expected is string)
132+
|| (expected is FieldInfo)
133+
|| (expected is PropertyInfo))
132134
{
133135
Assert.AreEqual(expected, actual, fieldPath);
134136
_fieldPath.Pop();

src/NHibernate.Test/NHSpecificTest/NH1904/Model.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,19 @@ public class Invoice
99

1010
protected virtual DateTime issued { get; set; }
1111
}
12+
13+
public class InvoiceWithAddress : Invoice
14+
{
15+
public virtual Address BillingAddress { get; set; }
16+
}
17+
18+
public struct Address
19+
{
20+
public string Line { get; set; }
21+
public string line { get; set; }
22+
public string Line2 { get; set; }
23+
public string City { get; set; }
24+
public string ZipCode { get; set; }
25+
public string Country { get; set; }
26+
}
1227
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections;
3+
using NUnit.Framework;
4+
5+
namespace NHibernate.Test.NHSpecificTest.NH1904
6+
{
7+
[TestFixture]
8+
public class StructFixture : BugTestCase
9+
{
10+
protected override IList Mappings =>
11+
new string[]
12+
{
13+
"NHSpecificTest." + BugNumber + ".StructMappings.hbm.xml"
14+
};
15+
16+
[Test]
17+
public void ExecuteQuery()
18+
{
19+
using (ISession session = OpenSession())
20+
using (ITransaction transaction = session.BeginTransaction())
21+
{
22+
var invoice = new InvoiceWithAddress
23+
{
24+
Issued = DateTime.Now,
25+
BillingAddress = new Address { Line = "84 rue du 22 septembre", City = "Courbevoie", ZipCode = "92400", Country = "France" }
26+
};
27+
session.Save(invoice);
28+
transaction.Commit();
29+
}
30+
31+
using (ISession session = OpenSession())
32+
{
33+
var invoices = session.CreateCriteria<Invoice>().List<Invoice>();
34+
}
35+
}
36+
37+
protected override void OnTearDown()
38+
{
39+
base.OnTearDown();
40+
using (ISession session = OpenSession())
41+
{
42+
session.CreateQuery("delete from InvoiceWithAddress").ExecuteUpdate();
43+
session.Flush();
44+
}
45+
}
46+
}
47+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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.NH1904">
5+
6+
<class name="InvoiceWithAddress">
7+
<id name="ID" type="Int32">
8+
<generator class="hilo" />
9+
</id>
10+
11+
<property name="Issued" type="DateTime" />
12+
13+
<component name="BillingAddress">
14+
<property name="Line"/>
15+
<property name="Line2"/>
16+
<property name="City"/>
17+
<property name="ZipCode"/>
18+
<property name="Country"/>
19+
</component>
20+
</class>
21+
22+
</hibernate-mapping>

src/NHibernate.Test/NHibernate.Test.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@
742742
<Compile Include="NHSpecificTest\EntityWithUserTypeCanHaveLinqGenerators\FooExample.cs" />
743743
<Compile Include="NHSpecificTest\EntityWithUserTypeCanHaveLinqGenerators\IExample.cs" />
744744
<Compile Include="Insertordering\NH3931Entities.cs" />
745+
<Compile Include="NHSpecificTest\NH1904\StructFixture.cs" />
745746
<Compile Include="NHSpecificTest\NH3247\Entity.cs" />
746747
<Compile Include="NHSpecificTest\NH3247\Fixture.cs" />
747748
<Compile Include="NHSpecificTest\NH3386\Entity.cs" />
@@ -3251,6 +3252,7 @@
32513252
<EmbeddedResource Include="NHSpecificTest\NH1291AnonExample\Mappings.hbm.xml" />
32523253
</ItemGroup>
32533254
<ItemGroup>
3255+
<EmbeddedResource Include="NHSpecificTest\NH1904\StructMappings.hbm.xml" />
32543256
<EmbeddedResource Include="Insertordering\FamilyModel\Mappings.hbm.xml" />
32553257
<EmbeddedResource Include="Insertordering\AnimalModel\Mappings.hbm.xml" />
32563258
<EmbeddedResource Include="NHSpecificTest\NH3247\Mappings.hbm.xml" />

0 commit comments

Comments
 (0)