Skip to content

Commit 8649f9a

Browse files
Merge pull request #609 from ManufacturingIntelligence/NH-3992
Fix mapping of intermediate inherited classes
2 parents a09830f + d147b77 commit 8649f9a

File tree

4 files changed

+812
-34
lines changed

4 files changed

+812
-34
lines changed
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
using System;
2+
3+
namespace NHibernate.Test.NHSpecificTest.NH3992
4+
{
5+
public class BaseEntity
6+
{
7+
public virtual Guid Id { get; set; }
8+
public virtual string BaseField { get; set; }
9+
}
10+
11+
public class MappedEntity : UnmappedEntity
12+
{
13+
public virtual string TopLevelField { get; set; }
14+
}
15+
16+
public class UnmappedEntity : BaseEntity
17+
{
18+
public virtual string ExtendedField { get; set; }
19+
}
20+
21+
public interface IBaseInterface
22+
{
23+
Guid Id { get; set; }
24+
string BaseField { get; set; }
25+
}
26+
27+
public interface IUnmappedInterface : IBaseInterface
28+
{
29+
string ExtendedField { get; set; }
30+
}
31+
32+
public class MappedEntityFromInterface : IUnmappedInterface
33+
{
34+
public virtual Guid Id { get; set; }
35+
public virtual string BaseField { get; set; }
36+
public virtual string ExtendedField { get; set; }
37+
public virtual string TopLevelField { get; set; }
38+
}
39+
40+
// Animal entities copied from NH2691
41+
public abstract class Animal
42+
{
43+
public virtual int Id { get; set; }
44+
public virtual string Description { get; set; }
45+
public virtual int Sequence { get; set; }
46+
}
47+
48+
public abstract class Mammal : Animal
49+
{
50+
public virtual bool Pregnant { get; set; }
51+
public virtual DateTime? BirthDate { get; set; }
52+
}
53+
54+
public class Dog : Mammal { }
55+
56+
// Mapped -> Unmapped -> Mapped -> Root
57+
namespace Longchain1
58+
{
59+
public class MappedRoot
60+
{
61+
public virtual Guid Id { get; set; }
62+
public virtual string BaseField { get; set; }
63+
}
64+
65+
public class MappedExtension : MappedRoot
66+
{
67+
public virtual string MappedExtensionField { get; set; }
68+
}
69+
70+
public class UnmappedExtension : MappedExtension
71+
{
72+
public virtual string UnmappedExtensionField { get; set; }
73+
}
74+
75+
public class TopLevel : UnmappedExtension
76+
{
77+
public virtual string TopLevelExtensionField { get; set; }
78+
}
79+
}
80+
81+
// Mapped -> Mapped -> Unmapped -> Root
82+
namespace Longchain2
83+
{
84+
public class MappedRoot
85+
{
86+
public virtual Guid Id { get; set; }
87+
public virtual string BaseField { get; set; }
88+
}
89+
90+
public class UnmappedExtension : MappedRoot
91+
{
92+
public virtual string UnmappedExtensionField { get; set; }
93+
}
94+
95+
public class MappedExtension : UnmappedExtension
96+
{
97+
public virtual string MappedExtensionField { get; set; }
98+
}
99+
100+
101+
public class TopLevel : MappedExtension
102+
{
103+
public virtual string TopLevelExtensionField { get; set; }
104+
}
105+
}
106+
107+
// Mapped -> Unmapped -> Mapped -> Unmapped -> Root
108+
namespace Longchain3
109+
{
110+
public class MappedRoot
111+
{
112+
public virtual Guid Id { get; set; }
113+
public virtual string BaseField { get; set; }
114+
}
115+
116+
public class FirstUnmappedExtension : MappedRoot
117+
{
118+
public virtual string FirstUnmappedExtensionField { get; set; }
119+
}
120+
121+
public class MappedExtension : FirstUnmappedExtension
122+
{
123+
public virtual string MappedExtensionField { get; set; }
124+
}
125+
126+
public class SecondUnmappedExtension : MappedExtension
127+
{
128+
public virtual string SecondUnmappedExtensionField { get; set; }
129+
}
130+
131+
public class TopLevel : SecondUnmappedExtension
132+
{
133+
public virtual string TopLevelExtensionField { get; set; }
134+
}
135+
}
136+
137+
}

0 commit comments

Comments
 (0)