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 @@ -203,9 +203,20 @@ public override void Configure(NHibernate.Cfg.Configuration configuration)
203
203
204
204
private void AddMapping ( Type type )
205
205
{
206
- log . BeginAutomappingType ( type ) ;
207
-
208
206
Type typeToMap = GetTypeToMap ( type ) ;
207
+
208
+ // Fixes https://github.com/jagregory/fluent-nhibernate/issues/113,
209
+ // where 'type' would not be mapped if 'GetTypeToMap' returned the
210
+ // base type
211
+ if ( typeToMap != type )
212
+ {
213
+ log . BeginAutomappingType ( type ) ;
214
+ var derivedMapping = autoMapper . Map ( type , mappingTypes ) ;
215
+
216
+ Add ( new PassThroughMappingProvider ( derivedMapping ) ) ;
217
+ }
218
+
219
+ log . BeginAutomappingType ( typeToMap ) ;
209
220
var mapping = autoMapper . Map ( typeToMap , mappingTypes ) ;
210
221
211
222
Add ( new PassThroughMappingProvider ( mapping ) ) ;
You can’t perform that action at this time.
0 commit comments