Gice a chance to import/export at failing migration

main
Paul Schneider 4 months ago
parent f914d712e2
commit 2615f65515
1 changed files with 12 additions and 4 deletions

@ -303,6 +303,8 @@ public static class HostingExtensions
public async static Task<WebApplication> ConfigurePipeline(this WebApplication app)
{
ILoggerFactory loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
var logger = loggerFactory.CreateLogger<Program>();
if (app.Environment.IsDevelopment())
{
@ -311,12 +313,19 @@ public static class HostingExtensions
else
{
app.UseExceptionHandler("/Home/Error");
try
{
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
await db.Database.MigrateAsync();
}
}
catch (Exception ex)
{
logger.LogError("Error migrating the database : {0}", ex);
}
}
app.Use(async (context, next) =>
{
@ -345,7 +354,6 @@ public static class HostingExtensions
WorkflowHelpers.ConfigureBillingService();
var services = app.Services;
ILoggerFactory loggerFactory = services.GetRequiredService<ILoggerFactory>();
var siteSettings = services.GetRequiredService<IOptions<SiteSettings>>();
var smtpSettings = services.GetRequiredService<IOptions<SmtpSettings>>();
var payPalSettings = services.GetRequiredService<IOptions<PayPalSettings>>();

Loading…