// 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) { app.UseComandante(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseCookiePolicy(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); using (var scope = serviceProvider.CreateScope()) { //var efOptions = (Microsoft.EntityFrameworkCore.Internal.LoggingOptions)scope.ServiceProvider.GetService(typeof(Microsoft.EntityFrameworkCore.Diagnostics.ILoggingOptions)); //efOptions.IsSensitiveDataLoggingEnabled = true; //efOptions.GetType().GetProperty("IsSensitiveDataLoggingEnabled").SetValue(efOptions, true); //EntityFrameworkServicesBuilder. using (ComandanteTestsWebContext dbContext = scope.ServiceProvider.GetService <ComandanteTestsWebContext>()) { dbContext.Database.Migrate(); } } }
public HomeController(ILogger <HomeController> logger, ComandanteTestsWebContext dbContext) { Logger = logger; DbContext = dbContext; }