protected void Application_Start() { AppLog.TraceInformation("Portfolio application starting..."); AppLog.Indent(); GlobalConfiguration.Configure(WebApiConfig.Register); GlobalConfiguration.Configuration.MessageHandlers.Add(new ApiKeyMessageHandler()); GlobalConfiguration.Configuration.Filters.Add(new LogExceptionFilterAttribute()); PortfolioMapper.Configure(); AppLog.Unindent(); AppLog.TraceInformation("Portfolio application started."); }
public static void Configure() { AppLog.TraceInformation("Configuring mappers..."); AppLog.Indent(); AppLog.TraceInformation($"Creating {nameof(ProjectMapper)}"); projectConfig = new MapperConfiguration(cfg => { cfg.AllowNullCollections = true; cfg.AddProfile <PostgresODDProjectMappingProfile>(); cfg.AddProfile <PostgresSERDProjectMappingProfile>(); cfg.AddProfile <ProjectViewModelProfile>(); cfg.AddProfile <ProjectUpdateModelProfile>(); cfg.AddProfile <ProjectQueryModelProfile>(); cfg.AddProfile <ProjectEditOptionsMappingProfile>(); }); ProjectMapper = projectConfig.CreateMapper(); AppLog.TraceInformation($"Creating {nameof(ConfigMapper)}"); configConfig = new MapperConfiguration(cfg => { cfg.AddProfile <PortfolioMappingProfile>(); cfg.AddProfile <PortfolioConfigurationMappingProfile>(); cfg.AddProfile <PortfolioSummariesMappingProfile>(); }); ConfigMapper = configConfig.CreateMapper(); AppLog.TraceInformation($"Creating {nameof(UpdateMapper)}"); updateConfig = new MapperConfiguration(cfg => { cfg.AddProfile <PortfolioConfigUpdateProfile>(); }); UpdateMapper = updateConfig.CreateMapper(); AppLog.TraceInformation($"Creating {nameof(ActiveDirectoryMapper)}"); activeDirectoryConfig = new MapperConfiguration(cfg => { cfg.AddProfile <ADUserMappingProfile>(); }); ActiveDirectoryMapper = activeDirectoryConfig.CreateMapper(); AppLog.TraceInformation($"Creating {nameof(ExportMapper)}"); exportConfig = new MapperConfiguration(cfg => { cfg.AllowNullCollections = true; cfg.AddProfile <ProjectExportModelProfile>(); cfg.AddProfile <ProjectImportModelProfile>(); }); ExportMapper = exportConfig.CreateMapper(); AppLog.Unindent(); AppLog.TraceInformation("Mappers configured."); }