21 lines
		
	
	
		
			735 B
		
	
	
	
		
			C#
		
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			735 B
		
	
	
	
		
			C#
		
	
	
using Microsoft.AspNetCore.Builder;
 | 
						|
using Task = System.Threading.Tasks.Task;
 | 
						|
 | 
						|
namespace Brizco.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();
 | 
						|
                await identityDbInitialize.Refactor();
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |