@@ -256,7 +256,7 @@ private static Dictionary<Type, Type> AddTypeMappingsFromDelegates(this Dictiona
256256 if ( typeMappings == null )
257257 throw new ArgumentException ( Resource . typeMappingsDictionaryIsNull ) ;
258258
259- typeMappings . DoAddTypeMappings
259+ typeMappings . DoAddTypeMappingsFromDelegates
260260 (
261261 configurationProvider ,
262262 sourceType . GetGenericArguments ( ) . ToList ( ) ,
@@ -266,7 +266,7 @@ private static Dictionary<Type, Type> AddTypeMappingsFromDelegates(this Dictiona
266266 return typeMappings ;
267267 }
268268
269- private static void DoAddTypeMappings ( this Dictionary < Type , Type > typeMappings , IConfigurationProvider configurationProvider , List < Type > sourceArguments , List < Type > destArguments )
269+ private static void DoAddTypeMappingsFromDelegates ( this Dictionary < Type , Type > typeMappings , IConfigurationProvider configurationProvider , List < Type > sourceArguments , List < Type > destArguments )
270270 {
271271 if ( sourceArguments . Count != destArguments . Count )
272272 throw new ArgumentException ( Resource . invalidArgumentCount ) ;
@@ -278,6 +278,18 @@ private static void DoAddTypeMappings(this Dictionary<Type, Type> typeMappings,
278278 }
279279 }
280280
281+ private static void DoAddTypeMappings ( this Dictionary < Type , Type > typeMappings , IConfigurationProvider configurationProvider , List < Type > sourceArguments , List < Type > destArguments )
282+ {
283+ if ( sourceArguments . Count != destArguments . Count )
284+ return ;
285+
286+ for ( int i = 0 ; i < sourceArguments . Count ; i ++ )
287+ {
288+ if ( ! typeMappings . ContainsKey ( sourceArguments [ i ] ) && sourceArguments [ i ] != destArguments [ i ] )
289+ typeMappings . AddTypeMapping ( configurationProvider , sourceArguments [ i ] , destArguments [ i ] ) ;
290+ }
291+ }
292+
281293 private static void FindChildPropertyTypeMaps ( this Dictionary < Type , Type > typeMappings , IConfigurationProvider ConfigurationProvider , Type source , Type dest )
282294 {
283295 //The destination becomes the source because to map a source expression to a destination expression,
0 commit comments