DD.WellWorkover.Cloud/AsbCloudInfrastructure/Startup.cs

26 lines
823 B
C#
Raw Normal View History

using AsbCloudApp.Services;
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
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.EnshureTimezonesIsSet();
}
}
}