Olga Nemt
828864c112
- Persistence.API - Persistence.Database - Persistence.Repository - Persistence.IntegrationTests
20 lines
530 B
C#
20 lines
530 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Persistence.Database;
|
|
using Persistence.Database.Model;
|
|
|
|
namespace Persistence.Repository;
|
|
public class Startup
|
|
{
|
|
public static void BeforeRunHandler(IHost host)
|
|
{
|
|
using var scope = host.Services.CreateScope();
|
|
var provider = scope.ServiceProvider;
|
|
|
|
var context = provider.GetRequiredService<DbContext>();
|
|
context.Database.EnsureCreatedAndMigrated();
|
|
|
|
}
|
|
}
|