public async Task InsertStatesSampleData(LookupDbContext db)
        {
            var states = GetStates();

            db.States.AddRange(states);
            try
            {
                int numAffected = await db.SaveChangesAsync();

                _Logger.LogInformation(@"Saved {numAffected} states");
            }
            catch (Exception exp)
            {
                _Logger.LogError($"Error in {nameof(LookupDbSeeder)}: " + exp.Message);
                throw;
            }
        }
Ejemplo n.º 2
0
 public LookupRepository(LookupDbContext context, ILoggerFactory loggerFactory)
 {
     _Context = context;
     _Logger  = loggerFactory.CreateLogger("LookupRepository");
 }