File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed
FluentNHibernate.Testing/DomainModel/Mapping
FluentNHibernate/MappingModel/Collections Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,26 @@ public void MixedKeyPropertyAndManyToOneOrdering()
159
159
. RootElement . Element ( "class/composite-id/*[2]" )
160
160
. HasName ( "key-property" ) ;
161
161
}
162
+
163
+ [ Test ]
164
+ public void CompositeIdWithSubclass ( )
165
+ {
166
+ new MappingTester < CompIdTarget > ( )
167
+ . SubClassMapping < ComIdSubclass > ( s =>
168
+ {
169
+ s . Table ( "subclasstable" ) ;
170
+ s . KeyColumn ( "subclass_longId" ) ;
171
+ s . KeyColumn ( "subclass_nullablelongId" ) ;
172
+ } )
173
+ . ForMapping ( c => c . CompositeId ( )
174
+ . KeyProperty ( x => x . LongId )
175
+ . KeyProperty ( x => x . NullableLongId ) )
176
+ . Element ( "class/joined-subclass/key/*[1]" )
177
+ . Exists ( ) . HasName ( "column" ) . HasAttribute ( "name" , "subclass_longId" )
178
+ . RootElement . Element ( "class/joined-subclass/key/*[2]" )
179
+ . Exists ( ) . HasName ( "column" ) . HasAttribute ( "name" , "subclass_nullablelongId" )
180
+ ;
181
+ }
162
182
163
183
public class CompIdTarget
164
184
{
@@ -183,5 +203,10 @@ public class ComponentKey
183
203
public virtual int KeyCol1 { get ; set ; }
184
204
public virtual int KeyCol2 { get ; set ; }
185
205
}
206
+
207
+ public class ComIdSubclass : CompIdTarget
208
+ {
209
+
210
+ }
186
211
}
187
212
}
Original file line number Diff line number Diff line change 1
1
using System ;
2
2
using System . Collections . Generic ;
3
3
using System . Linq ;
4
+ using System . Runtime . Serialization ;
4
5
5
6
namespace FluentNHibernate . MappingModel . Collections
6
7
{
7
8
[ Serializable ]
8
- public class AttributeLayeredValues
9
+ public class AttributeLayeredValues : ISerializable
9
10
{
10
- readonly Dictionary < string , LayeredValues > inner = new Dictionary < string , LayeredValues > ( ) ;
11
+ readonly Dictionary < string , LayeredValues > inner ;
11
12
13
+ public AttributeLayeredValues ( )
14
+ {
15
+ inner = new Dictionary < string , LayeredValues > ( ) ;
16
+ }
17
+
18
+ public AttributeLayeredValues ( SerializationInfo info , StreamingContext context )
19
+ {
20
+ inner = ( Dictionary < string , LayeredValues > ) info
21
+ . GetValue ( "inner" , typeof ( Dictionary < string , LayeredValues > ) ) ;
22
+ inner . OnDeserialization ( this ) ;
23
+ }
24
+
12
25
public LayeredValues this [ string attribute ]
13
26
{
14
27
get
@@ -90,5 +103,10 @@ public override int GetHashCode()
90
103
91
104
return hashCode ;
92
105
}
106
+
107
+ public void GetObjectData ( SerializationInfo info , StreamingContext context )
108
+ {
109
+ info . AddValue ( "inner" , inner ) ;
110
+ }
93
111
}
94
112
}
You can’t perform that action at this time.
0 commit comments