|
|
@ -18,6 +18,7 @@ using nuget_host.Interfaces;
|
|
|
|
using nuget_host.Services;
|
|
|
|
using nuget_host.Services;
|
|
|
|
using nuget_host.Entities;
|
|
|
|
using nuget_host.Entities;
|
|
|
|
using nuget_host.Models;
|
|
|
|
using nuget_host.Models;
|
|
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
|
|
|
|
namespace nuget_host
|
|
|
|
namespace nuget_host
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -70,6 +71,25 @@ namespace nuget_host
|
|
|
|
{
|
|
|
|
{
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
app.UseHsts();
|
|
|
|
app.UseHsts();
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
|
|
|
|
|
|
|
|
.CreateScope())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
serviceScope.ServiceProvider.GetService<ApplicationDbContext>()
|
|
|
|
|
|
|
|
.Database.Migrate();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (TargetInvocationException ex)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ex.InnerException is InvalidOperationException)
|
|
|
|
|
|
|
|
// nothing to do ?
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO (or not) Hit the developper
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else throw ex;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
app.UseStaticFiles();
|
|
|
|