@@ -11,7 +11,7 @@ internal class MapperConfiguration
1111 {
1212 public List < PropertyMapping > Mappings { get ; set ; }
1313 public bool EnableDefaultMapping { get ; set ; }
14-
14+
1515 public MapperConfiguration ( List < PropertyMapping > mappings , bool enableDefaultMapping )
1616 {
1717 Mappings = mappings ?? new List < PropertyMapping > ( ) ;
@@ -38,7 +38,7 @@ public void CreateMap<TSource, TTarget>(List<PropertyMapping> mappings = null)
3838
3939 _configurations [ sourceType ] [ targetType ] = new MapperConfiguration ( mappings , true ) ;
4040 }
41-
41+
4242 public void CreateMap < TSource , TTarget > ( List < PropertyMapping > mappings , bool enableDefaultMapping )
4343 {
4444 var sourceType = typeof ( TSource ) ;
@@ -146,7 +146,7 @@ private void ApplyDefaultNameBasedMapping<TSource, TTarget>(
146146
147147 var nestedSourceValue = sourceValue ;
148148 // Use reflection to call the right generic method for nested mapping
149- var genericMethod = typeof ( Mapper ) . GetMethod ( nameof ( ApplyNameBasedMapping ) ,
149+ var genericMethod = typeof ( Mapper ) . GetMethod ( nameof ( ApplyNameBasedMapping ) ,
150150 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Instance ) ;
151151 var specificMethod = genericMethod . MakeGenericMethod ( sourceProp . PropertyType , targetProp . PropertyType ) ;
152152 specificMethod . Invoke ( this , new object [ ] { nestedSourceValue , nestedTargetValue } ) ;
@@ -194,7 +194,7 @@ internal void ApplyNameBasedMapping<TSource, TTarget>(TSource source, TTarget ta
194194 }
195195
196196 // Recursively map the nested object properties using reflection
197- var genericMethod = typeof ( Mapper ) . GetMethod ( nameof ( ApplyNameBasedMapping ) ,
197+ var genericMethod = typeof ( Mapper ) . GetMethod ( nameof ( ApplyNameBasedMapping ) ,
198198 System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Instance ) ;
199199 var specificMethod = genericMethod . MakeGenericMethod ( sourceProp . PropertyType , targetProp . PropertyType ) ;
200200 specificMethod . Invoke ( this , new object [ ] { sourceValue , nestedTargetValue } ) ;
@@ -319,13 +319,13 @@ private object ConvertValue(object value, Type targetType)
319319 // an object of one type to another (e.g., assigning Address object to AddressWithConfig property)
320320 if ( IsComplexType ( targetType ) && value != null && ! targetType . IsAssignableFrom ( value . GetType ( ) ) )
321321 {
322- try
322+ try
323323 {
324324 // Use the main Map method to convert the object from one type to another
325325 var sourceType = value . GetType ( ) ;
326- var genericMapMethod = typeof ( Mapper ) . GetMethod ( nameof ( Map ) ,
326+ var genericMapMethod = typeof ( Mapper ) . GetMethod ( nameof ( Map ) ,
327327 System . Reflection . BindingFlags . Instance | System . Reflection . BindingFlags . Public ) ;
328-
328+
329329 if ( genericMapMethod != null )
330330 {
331331 var specificMapMethod = genericMapMethod . MakeGenericMethod ( sourceType , targetType ) ;
@@ -338,22 +338,22 @@ private object ConvertValue(object value, Type targetType)
338338 return value ;
339339 }
340340 }
341-
341+
342342 return value ;
343343 }
344344
345345 private object Map ( object source , Type targetType )
346346 {
347347 var sourceType = source . GetType ( ) ;
348348 // Get the generic Map method (TTarget Map<TSource, TTarget>(TSource source))
349- var genericMapMethod = typeof ( Mapper ) . GetMethod ( nameof ( Map ) ,
349+ var genericMapMethod = typeof ( Mapper ) . GetMethod ( nameof ( Map ) ,
350350 System . Reflection . BindingFlags . Instance | System . Reflection . BindingFlags . Public ) ;
351-
351+
352352 if ( genericMapMethod == null )
353353 {
354354 throw new InvalidOperationException ( $ "Could not find Map method for source type { sourceType } ") ;
355355 }
356-
356+
357357 var specificMapMethod = genericMapMethod . MakeGenericMethod ( sourceType , targetType ) ;
358358 return specificMapMethod . Invoke ( this , new object [ ] { source } ) ;
359359 }
0 commit comments