2023-09-15 12:37:02 +03:30
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
|
using Task = System.Threading.Tasks.Task;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Brizco.Repository;
|
|
|
|
|
|
public static class RepositoryConfig
|
2023-09-08 12:25:21 +03:30
|
|
|
|
{
|
2023-09-15 12:37:02 +03:30
|
|
|
|
public static async Task InitialDb(this IApplicationBuilder app)
|
2023-09-08 12:25:21 +03:30
|
|
|
|
{
|
2023-09-15 12:37:02 +03:30
|
|
|
|
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();
|
2024-04-25 02:33:17 +03:30
|
|
|
|
await identityDbInitialize.Refactor();
|
2023-09-15 12:37:02 +03:30
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-09-08 12:25:21 +03:30
|
|
|
|
}
|
|
|
|
|
|
}
|