public async Task InsertCrudSampleData(Ng4DotNetDbContext db) { var crudList = GetCrudList(); db.CrudList.AddRange(crudList); try { int numAffected = await db.SaveChangesAsync(); _Logger.LogInformation($"Saved {numAffected} crudList"); } catch (Exception exp) { _Logger.LogError($"Error in {nameof(Ng4DotNetDbSeeder)}: " + exp.Message); throw; } }
public CrudRepository(Ng4DotNetDbContext context, ILoggerFactory loggerFactory) { _context = context; _logger = loggerFactory.CreateLogger("CrudRepository"); }