private static void LoadStandardMappings(IEnumerable<Type> types)
{
var maps = types.SelectMany(t => t.GetInterfaces(), (t, i) => new { t, i })
.Where(
type =>
type.i.IsGenericType && type.i.GetGenericTypeDefinition() == typeof(IMapFrom<>) &&
!type.t.IsAbstract
&& !type.t.IsInterface)
.Select(type => new { Source = type.i.GetGenericArguments()[0], Destination = type.t });
foreach (var map in maps)
{
Mapper.CreateMap(map.Source, map.Destination);
Mapper.CreateMap(map.Destination, map.Source);
}
}