forked from ddrilling/AsbCloudServer
27 lines
877 B
C#
27 lines
877 B
C#
using AsbCloudApp.Services;
|
|
using AsbCloudDb.Model;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace AsbCloudInfrastructure
|
|
{
|
|
public class Startup
|
|
{
|
|
public static void BeforeRunHandler(IHost host, IConfigurationRoot configuration)
|
|
{
|
|
using var scope = host.Services.CreateScope();
|
|
var context = scope.ServiceProvider.GetService<IAsbCloudDbContext>();
|
|
context.Database.SetCommandTimeout(TimeSpan.FromSeconds(2 * 60));
|
|
|
|
context.Database.Migrate();
|
|
|
|
var wellService = scope.ServiceProvider.GetService<IWellService>();
|
|
wellService.EnshureTimezonesIsSetAsync(System.Threading.CancellationToken.None).Wait();
|
|
}
|
|
}
|
|
}
|