Commit e3de8110 authored by garyhuntddn's avatar garyhuntddn

provision of TypeMapProvider to allow lazy creation of type maps only when they are needed

parent 885a8d46
...@@ -2154,6 +2154,12 @@ static readonly MethodInfo ...@@ -2154,6 +2154,12 @@ static readonly MethodInfo
.Where(p => p.GetIndexParameters().Any() && p.GetIndexParameters()[0].ParameterType == typeof(int)) .Where(p => p.GetIndexParameters().Any() && p.GetIndexParameters()[0].ParameterType == typeof(int))
.Select(p => p.GetGetMethod()).First(); .Select(p => p.GetGetMethod()).First();
/// <summary>
/// Gets type-map for the given type
/// </summary>
/// <returns>Type map instance, default is to create new instance of DefaultTypeMap</returns>
public static Func<Type, ITypeMap> TypeMapProvider = ( Type type ) => new DefaultTypeMap( type );
/// <summary> /// <summary>
/// Gets type-map for the given type /// Gets type-map for the given type
/// </summary> /// </summary>
...@@ -2170,7 +2176,7 @@ public static ITypeMap GetTypeMap(Type type) ...@@ -2170,7 +2176,7 @@ public static ITypeMap GetTypeMap(Type type)
map = (ITypeMap)_typeMaps[type]; map = (ITypeMap)_typeMaps[type];
if (map == null) if (map == null)
{ {
map = new DefaultTypeMap(type); map = TypeMapProvider( type );
_typeMaps[type] = map; _typeMaps[type] = map;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment