File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed
FluentNHibernate.Testing/DomainModel/Mapping Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -173,5 +173,27 @@ public void AnyIsAfterIdElement()
173
173
174
174
mapTest . Element ( "class/id" ) . ShouldBeInParentAtPosition ( 0 ) ;
175
175
}
176
+
177
+
178
+ [ Test ]
179
+ public void SpecificMetaTypeShouldNotClearMetaValues ( )
180
+ {
181
+ var mapTest = new MappingTester < MappedObject > ( )
182
+ . ForMapping ( map =>
183
+ {
184
+ map . Id ( x => x . Id ) ;
185
+ map . ReferencesAny ( x => x . Parent )
186
+ . EntityIdentifierColumn ( "AnyId" )
187
+ . EntityTypeColumn ( "AnyType" )
188
+ . IdentityType ( x => x . Id )
189
+ . MetaType < int > ( )
190
+ . AddMetaValue < SecondMappedObject > ( "1" ) ;
191
+ } ) ;
192
+
193
+ mapTest
194
+ . Element ( "class/any/meta-value" )
195
+ . HasAttribute ( "value" , "1" )
196
+ . HasAttribute ( "class" , typeof ( SecondMappedObject ) . AssemblyQualifiedName ) ;
197
+ }
176
198
}
177
199
}
Original file line number Diff line number Diff line change @@ -156,15 +156,10 @@ AnyMapping IAnyMappingProvider.GetAnyMapping()
156
156
if ( ! mapping . IsSpecified ( "Name" ) )
157
157
mapping . Name = property . Name ;
158
158
159
+ metaValues . Each ( mapping . AddMetaValue ) ;
159
160
if ( ! mapping . IsSpecified ( "MetaType" ) )
160
161
{
161
- if ( metaValues . Count ( ) > 0 )
162
- {
163
- metaValues . Each ( mapping . AddMetaValue ) ;
164
- mapping . MetaType = new TypeReference ( typeof ( string ) ) ;
165
- }
166
- else
167
- mapping . MetaType = new TypeReference ( property . PropertyType ) ;
162
+ mapping . MetaType = metaValues . Count ( ) > 0 ? new TypeReference ( typeof ( string ) ) : new TypeReference ( property . PropertyType ) ;
168
163
}
169
164
170
165
foreach ( var column in typeColumns )
You can’t perform that action at this time.
0 commit comments