示例#1
0
        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);
            }
        }
示例#2
0
 public BaseRepository(ManagementContext dbContext)
 {
     _dbContext = dbContext;
 }