// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseSession(); app.UseStatusCodePages(); app.UseStaticFiles(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); MyDbInitializer.Initialize(serviceProvider.GetRequiredService <MyDbContext>(), serviceProvider.GetRequiredService <UserManager <ApplicationUser> >(), serviceProvider.GetRequiredService <RoleManager <IdentityRole <Int32> > >(), "..\\Data"); }
// 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, MyDbContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseDefaultFiles(); app.UseStaticFiles(); app.UseMvc(); MyDbInitializer.Initialize(context); }