public void Configure(IApplicationBuilder app, IHostApplicationLifetime appLifetime) { // Write streamlined request completion events, instead of the more verbose ones from the framework. // To use the default framework request logging instead, remove this line and set the "Microsoft" // level in appsettings.json to "Information". app.UseSerilogRequestLogging(); appLifetime.ApplicationStarted.Register(OnStarted, app); _engineStarter.ConfigureApplication(app); }
public void Configure(IApplicationBuilder app, IHostApplicationLifetime appLifetime) { //using (var scope = app.ApplicationServices.CreateScope()) //{ // var db = scope.ServiceProvider.GetRequiredService<SmartDbContext>(); // if (!db.Database.GetService<IRelationalDatabaseCreator>().Exists()) // { // db.Database.Migrate(); // } // else // { // var hasLegacyMigrations = db.DataProvider.HasTable("__MigrationHistory"); // if (hasLegacyMigrations) // { // var firstPendingMigration = db.Database.GetPendingMigrations().FirstOrDefault(); // if (firstPendingMigration != "Initial") // { // db.Database.Migrate(); // } // } // else // { // db.Database.Migrate(); // } // } //} // Must come very early. app.UseContextState(); // Write streamlined request completion events, instead of the more verbose ones from the framework. // To use the default framework request logging instead, remove this line and set the "Microsoft" // level in appsettings.json to "Information". app.UseSerilogRequestLogging(); // Executes IApplicationInitializer implementations // during the very first request. if (_appContext.IsInstalled) { app.UseApplicationInitializer(); } appLifetime.ApplicationStarted.Register(OnStarted, app); _engineStarter.ConfigureApplication(app); }
public void Configure(IApplicationBuilder app, IHostApplicationLifetime appLifetime) { // Must come very early. app.UseContextState(); // Write streamlined request completion events, instead of the more verbose ones from the framework. // To use the default framework request logging instead, remove this line and set the "Microsoft" // level in appsettings.json to "Information". app.UseSerilogRequestLogging(); // Executes IApplicationInitializer implementations // during the very first request. if (_appContext.IsInstalled) { app.UseApplicationInitializer(); } appLifetime.ApplicationStarted.Register(OnStarted, app); _engineStarter.ConfigureApplication(app); }