public static IServiceCollection AddMapper(this IServiceCollection services) { var dataProfiles = MappingProfile.GetDataProfiles(); var config = new MapperConfiguration(cfg => { dataProfiles.ForEach(p => cfg.AddProfile(p)); //cfg.AddProfile(new IncidentModelProfile()); }); var mapper = config.CreateMapper(); services.AddSingleton(mapper); return(services); }