private static void AddAutoMapper(IProfileRegistry profileRegistry) { var profiles = AssemblyHandler.GetProfileTypes(); var mapperConfiguration = new MapperConfiguration( cfg => { foreach (var profile in profiles) { cfg.AddProfile(profile); } }); var mapper = mapperConfiguration.CreateMapper(); profileRegistry.For <IMapper>().Use(mapper); }