protected virtual void EnsureDatabaseMigrations(IApplicationBuilder app) { using IServiceScope scope = app.ApplicationServices.CreateScope(); System.IServiceProvider services = scope.ServiceProvider; try { BBBankContext context = services.GetRequiredService <BBBankContext>(); context.Database.Migrate(); } catch (System.Exception ex) { ILogger <Startup> logger = services.GetRequiredService <ILogger <Startup> >(); logger.LogError(ex, "An error occured during database migration"); throw; } }
public WeatherForecastController(BBBankContext bBBankContext) { _bBBankContext = bBBankContext; }