2023-10-10 18:01:21 +03:30
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
2023-10-10 17:02:38 +03:30
|
|
|
|
|
2023-10-10 18:01:21 +03:30
|
|
|
|
namespace DocuMed.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();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|