File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/FluentNHibernate/Automapping Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -121,22 +121,22 @@ Dictionary<AutoMapType, AutoMapType> GetMappingTypesWithLogicalParents()
121
121
var excludedTypes = mappingTypes
122
122
. Where ( x => cfg . IsConcreteBaseType ( x . Type . BaseType ) )
123
123
. ToArray ( ) ;
124
- var availableTypes = mappingTypes . Except ( excludedTypes ) ;
124
+ var availableTypes = mappingTypes . Except ( excludedTypes ) . ToDictionary ( x => x . Type ) ;
125
125
var mappingTypesWithLogicalParents = new Dictionary < AutoMapType , AutoMapType > ( ) ;
126
126
127
127
foreach ( var type in availableTypes )
128
- mappingTypesWithLogicalParents . Add ( type , GetLogicalParent ( type . Type , availableTypes ) ) ;
128
+ mappingTypesWithLogicalParents . Add ( type . Value , GetLogicalParent ( type . Key , availableTypes ) ) ;
129
129
return mappingTypesWithLogicalParents ;
130
130
}
131
131
132
- static AutoMapType GetLogicalParent ( Type type , IEnumerable < AutoMapType > availableTypes )
132
+ static AutoMapType GetLogicalParent ( Type type , IDictionary < Type , AutoMapType > availableTypes )
133
133
{
134
134
if ( type . BaseType == typeof ( object ) || type . BaseType == null )
135
135
return null ;
136
136
137
- var baseType = availableTypes . FirstOrDefault ( x => x . Type == type . BaseType ) ;
137
+ AutoMapType baseType ;
138
138
139
- if ( baseType != null )
139
+ if ( availableTypes . TryGetValue ( type . BaseType , out baseType ) )
140
140
return baseType ;
141
141
142
142
return GetLogicalParent ( type . BaseType , availableTypes ) ;
You can’t perform that action at this time.
0 commit comments