Gice a chance to import/export at failing migration
This commit is contained in:
parent
4226126278
commit
a19df9f77b
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)
|
public async static Task<WebApplication> ConfigurePipeline(this WebApplication app)
|
||||||
{
|
{
|
||||||
|
ILoggerFactory loggerFactory = app.Services.GetRequiredService<ILoggerFactory>();
|
||||||
|
var logger = loggerFactory.CreateLogger<Program>();
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
{
|
{
|
||||||
|
|
@ -311,10 +313,17 @@ public static class HostingExtensions
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
using (var scope = app.Services.CreateScope())
|
try
|
||||||
{
|
{
|
||||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
using (var scope = app.Services.CreateScope())
|
||||||
await db.Database.MigrateAsync();
|
{
|
||||||
|
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||||
|
await db.Database.MigrateAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.LogError("Error migrating the database : {0}", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -345,7 +354,6 @@ public static class HostingExtensions
|
||||||
WorkflowHelpers.ConfigureBillingService();
|
WorkflowHelpers.ConfigureBillingService();
|
||||||
|
|
||||||
var services = app.Services;
|
var services = app.Services;
|
||||||
ILoggerFactory loggerFactory = services.GetRequiredService<ILoggerFactory>();
|
|
||||||
var siteSettings = services.GetRequiredService<IOptions<SiteSettings>>();
|
var siteSettings = services.GetRequiredService<IOptions<SiteSettings>>();
|
||||||
var smtpSettings = services.GetRequiredService<IOptions<SmtpSettings>>();
|
var smtpSettings = services.GetRequiredService<IOptions<SmtpSettings>>();
|
||||||
var payPalSettings = services.GetRequiredService<IOptions<PayPalSettings>>();
|
var payPalSettings = services.GetRequiredService<IOptions<PayPalSettings>>();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue