public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ManagementContext managementContext, ILoggerFactory loggerFactory) { try { if (!managementContext.Customers.Any()) { managementContext.Customers.AddRange( GetPreconfiguredListOfCustomers()); await managementContext.SaveChangesAsync(); } } catch (Exception ex) { var log = loggerFactory.CreateLogger <ManagementContextSeed>(); log.LogError(ex.Message); await SeedAsync(applicationBuilder, managementContext, loggerFactory); } }
public BaseRepository(ManagementContext dbContext) { _dbContext = dbContext; }