internal async Task Initialize() { Stopwatch stopWatch; // this routines loads data from Json and then stores them in updates dataservice _logger.LogInformation("Loading Json"); Schools schoolList = await _support.GetJson(_clientFactory); ErrorString = _support.ErrorString; if ((ErrorString != null) && (ErrorString.Length > 0)) { _logger.LogError("Error loading Json"); } else { if (schoolList.schools != null) { Records = schoolList.schools.Length; } if (AllowDapper == true) { _logger.LogInformation("Updating Dapper Sql database"); stopWatch = Stopwatch.StartNew(); await _support.UpdateData(schoolList, _sqlService); stopWatch.Stop(); DapperUpdatePerformance = (int)stopWatch.ElapsedMilliseconds; _logger.LogInformation("Dapper Update Performance is {perf}", DapperUpdatePerformance); ErrorString = _support.ErrorString; if ((ErrorString != null) && (ErrorString.Length > 0)) { _logger.LogError("Error updating Dapper SQL Database"); } } if (AllowEF == true) { _logger.LogInformation("Updating Entity Framework Sql database"); stopWatch = Stopwatch.StartNew(); await _support.UpdateData(schoolList, _efService); stopWatch.Stop(); EFUpdatePerformance = (int)stopWatch.ElapsedMilliseconds; _logger.LogInformation("Entity Framework Update Performance is {perf}", EFUpdatePerformance); ErrorString = _support.ErrorString; if ((ErrorString != null) && (ErrorString.Length > 0)) { _logger.LogError("Error updating Entity Framework SQL Database"); } } if (UseSim == true) { _logger.LogInformation("Updating Simulated database"); stopWatch = Stopwatch.StartNew(); await _support.UpdateData(schoolList, _simService); stopWatch.Stop(); SimUpdatePerformance = (int)stopWatch.ElapsedMilliseconds; _logger.LogInformation("Simulated Update Performance is {perf}", SimUpdatePerformance); ErrorString = _support.ErrorString; if ((ErrorString != null) && (ErrorString.Length > 0)) { _logger.LogError("Error updating Simulated Database"); } } } }
public async Task UpdateData(Schools schoolList) { await _support.UpdateData(schoolList, _dataService); ErrorString = _support.ErrorString; }