@@ -6,7 +6,7 @@ namespace AgileObjects.AgileMapper.Members
66
77 internal class MappingTypes
88 {
9- private MappingTypes (
9+ public MappingTypes (
1010 Type sourceType ,
1111 Type targetType ,
1212 bool runtimeTypesAreTheSame ,
@@ -20,13 +20,11 @@ private MappingTypes(
2020
2121 #region Factory Method
2222
23- public static MappingTypes Fixed < TSource , TTarget > ( ) => MappingTypesCache < TSource , TTarget > . Instance ;
24-
2523 public static MappingTypes For < TSource , TTarget > ( TSource source , TTarget target )
2624 {
27- if ( MappingTypesCache < TSource , TTarget > . SkipTypesCheck )
25+ if ( MappingTypes < TSource , TTarget > . SkipTypesCheck )
2826 {
29- return Fixed < TSource , TTarget > ( ) ;
27+ return MappingTypes < TSource , TTarget > . Fixed ;
3028 }
3129
3230 var runtimeSourceTypeNeeded = TypeInfo < TSource > . RuntimeTypeNeeded ;
@@ -78,7 +76,7 @@ public static MappingTypes For<TSource, TTarget>(TSource source, TTarget target)
7876
7977 if ( ! runtimeTypesNeeded )
8078 {
81- return Fixed < TSource , TTarget > ( ) ;
79+ return MappingTypes < TSource , TTarget > . Fixed ;
8280 }
8381
8482 var isEnumerable = TypeInfo < TTarget > . IsEnumerable ||
@@ -121,17 +119,17 @@ public MappingTypes WithTypes<TNewSource, TNewTarget>()
121119 RuntimeTypesAreTheSame ,
122120 IsEnumerable ) ;
123121 }
122+ }
124123
125- private static class MappingTypesCache < TSource , TTarget >
126- {
127- public static readonly bool SkipTypesCheck =
128- ! ( TypeInfo < TSource > . RuntimeTypeNeeded || TypeInfo < TTarget > . RuntimeTypeNeeded ) ;
129-
130- public static readonly MappingTypes Instance = new MappingTypes (
131- typeof ( TSource ) ,
132- typeof ( TTarget ) ,
133- true , // <- runtimeTypesAreTheSame
134- TypeInfo < TTarget > . IsEnumerable ) ;
135- }
124+ internal static class MappingTypes < TSource , TTarget >
125+ {
126+ public static readonly bool SkipTypesCheck =
127+ ! ( TypeInfo < TSource > . RuntimeTypeNeeded || TypeInfo < TTarget > . RuntimeTypeNeeded ) ;
128+
129+ public static readonly MappingTypes Fixed = new MappingTypes (
130+ typeof ( TSource ) ,
131+ typeof ( TTarget ) ,
132+ true , // <- runtimeTypesAreTheSame
133+ TypeInfo < TTarget > . IsEnumerable ) ;
136134 }
137135}
0 commit comments