Api/Netina.Repository/RepositoryConfig.cs

20 lines
647 B
C#
Raw Normal View History

2024-04-16 20:01:34 +03:30
using Netina.Repository.Services.Abstracts;
namespace Netina.Repository;
2023-12-16 20:25:12 +03:30
public static class RepositoryConfig
{
public static async Task InitialDb(this IApplicationBuilder app)
{
var scopeFactory = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>();
using (var scope = scopeFactory.CreateScope())
{
var identityDbInitialize = scope.ServiceProvider.GetService<IDbInitializerService>();
if (identityDbInitialize != null)
{
identityDbInitialize.Initialize();
await identityDbInitialize.SeedDate();
}
}
}
}