|
|
|
@ -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,12 +313,19 @@ public static class HostingExtensions
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
using (var scope = app.Services.CreateScope())
|
|
|
|
using (var scope = app.Services.CreateScope())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
|
|
|
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
|
|
|
await db.Database.MigrateAsync();
|
|
|
|
await db.Database.MigrateAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
logger.LogError("Error migrating the database : {0}", ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
app.Use(async (context, next) =>
|
|
|
|
app.Use(async (context, next) =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -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>>();
|
|
|
|
|