private static void RunConfig(IMapperConfigurationExpression cfg) { var assemblies = Config.MappedAssemblies.SelectMany(x => x.Value).ToArray(); var target = typeof(IMapperHelper); foreach (var item in assemblies) { var maps = item .GetTypes() .Where(t => t != target && target.IsAssignableFrom(t) ).ToList(); foreach (var map in maps) { IMapperHelper obj = Activator.CreateInstance(map) as IMapperHelper; Trace.WriteLine($"[automapper] Loading map '{ map.Name }'..."); obj.Config(cfg); } } }