// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, LibraryContext libraryContext) { loggerFactory.AddConsole(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler(appBuilder => { appBuilder.Run(async context => { context.Response.StatusCode = 500; await context.Response.WriteAsync("An unexpected fault occured. Try again later."); }); }); } var modelMappings = new ModelMappings(); modelMappings.MapModels(); libraryContext.EnsureSeedDataForContext(); app.UseMvc(); }
protected void Application_Start() { // Disable ASP.NET MVC version header MvcHandler.DisableMvcResponseHeader = true; // Don't bother looking for the legacy aspx view engine. ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); RouteConfig.RegisterRoutes(RouteTable.Routes); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); var db = new DateTimeModelBinder(); ModelBinders.Binders.Add(typeof(DateTime), db); ModelBinders.Binders.Add(typeof(DateTime?), db); ModelMappings.Initialise(); Roles.CreateRole("Administrators"); Roles.CreateRole("Editors"); Roles.CreateRole("Users"); MongoConfig.SetupIndexes(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); ModelMappings.Start(); }
private async Task <ModelMappings> LoadMappingFileAsync() { ModelMappings result = null; this.log.LogInformation($"Started loading mapping file from {this.options.MappingFilePath}."); var jsonMappingsString = await File.ReadAllTextAsync(this.options.MappingFilePath); result = JsonSerializer.Deserialize <ModelMappings>(jsonMappingsString, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); this.log.LogInformation($"Finished loading mapping file from {this.options.MappingFilePath}."); return(result); }