Commit e3e44920 authored by Nick Craver's avatar Nick Craver

Merge pull request #110 from garyhuntddn/master

Simple Func to allow provision of TypeMaps automatically
parents bf7a46a5 e3de8110
...@@ -3598,6 +3598,12 @@ static readonly MethodInfo ...@@ -3598,6 +3598,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>
...@@ -3623,7 +3629,7 @@ public static ITypeMap GetTypeMap(Type type) ...@@ -3623,7 +3629,7 @@ public static ITypeMap GetTypeMap(Type 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