File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/FluentNHibernate/Automapping Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -205,9 +205,20 @@ public override void Configure(NHibernate.Cfg.Configuration configuration)
205
205
206
206
private void AddMapping ( Type type )
207
207
{
208
- log . BeginAutomappingType ( type ) ;
209
-
210
208
Type typeToMap = GetTypeToMap ( type ) ;
209
+
210
+ // Fixes https://github.com/jagregory/fluent-nhibernate/issues/113,
211
+ // where 'type' would not be mapped if 'GetTypeToMap' returned the
212
+ // base type
213
+ if ( typeToMap != type )
214
+ {
215
+ log . BeginAutomappingType ( type ) ;
216
+ var derivedMapping = autoMapper . Map ( type , mappingTypes ) ;
217
+
218
+ Add ( new PassThroughMappingProvider ( derivedMapping ) ) ;
219
+ }
220
+
221
+ log . BeginAutomappingType ( typeToMap ) ;
211
222
var mapping = autoMapper . Map ( typeToMap , mappingTypes ) ;
212
223
213
224
Add ( new PassThroughMappingProvider ( mapping ) ) ;
You can’t perform that action at this time.
0 commit comments