persistence/Persistence.Repository/Startup.cs
Olga Nemt 828864c112 Тестовые проект(ы) для реализации интерфейсов Persistence:
- Persistence.API
- Persistence.Database
- Persistence.Repository
- Persistence.IntegrationTests
2024-11-14 15:17:43 +05:00

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();
}
}