|
|
|
@ -60,7 +60,8 @@ namespace nuget_host
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
|
public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env)
|
|
|
|
|
public void Configure(IApplicationBuilder app, Microsoft.AspNetCore.Hosting.IHostingEnvironment env,
|
|
|
|
|
ApplicationDbContext dbContext)
|
|
|
|
|
{
|
|
|
|
|
if (env.IsDevelopment())
|
|
|
|
|
{
|
|
|
|
@ -73,12 +74,7 @@ namespace nuget_host
|
|
|
|
|
app.UseHsts();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
|
|
|
|
|
.CreateScope())
|
|
|
|
|
{
|
|
|
|
|
serviceScope.ServiceProvider.GetService<ApplicationDbContext>()
|
|
|
|
|
.Database.Migrate();
|
|
|
|
|
}
|
|
|
|
|
dbContext.Database.Migrate();
|
|
|
|
|
}
|
|
|
|
|
catch (TargetInvocationException ex)
|
|
|
|
|
{
|
|
|
|
|