Api/NetinaShop.Repository/RepositoryConfig.cs

18 lines
606 B
C#
Raw Normal View History

2023-12-16 20:25:12 +03:30
namespace NetinaShop.Repository;
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();
}
}
}
}