public async Task OnApplicationStartup(CancellationToken cancellationToken) { List <Task> TaskList = new List <Task>(); Task worldsTask = _worldService.RefreshStore(); TaskList.Add(worldsTask); Task factionsTask = _factionService.RefreshStore(); TaskList.Add(factionsTask); // Won't refresh if already populated Task itemsTask = _itemService.RefreshStore(); TaskList.Add(itemsTask); Task zoneTask = _zoneService.RefreshStore(); TaskList.Add(zoneTask); // Won't refresh if already populated Task titleTask = _titleService.RefreshStore(); TaskList.Add(titleTask); Task profileTask = _profileService.RefreshStore(); TaskList.Add(profileTask); await Task.WhenAll(TaskList); }
public async Task <ActionResult <IEnumerable <Zone> > > GetAllWorlds() { await _zoneService.RefreshStore(); IEnumerable <Zone> result = await _zoneService.GetAllZonesAsync(); return(result.ToArray()); }
public async Task SeedDatabase(CancellationToken cancellationToken) { try { List <Task> TaskList = new List <Task>(); Task worldsTask = _worldService.RefreshStore(true, true); TaskList.Add(worldsTask); Task factionsTask = _factionService.RefreshStore(true, true); TaskList.Add(factionsTask); Task itemsTask = _itemService.RefreshStore(true, true); TaskList.Add(itemsTask); Task itemCategoriesTask = _itemCategoryService.RefreshStore(true, true); TaskList.Add(itemCategoriesTask); Task zoneTask = _zoneService.RefreshStore(true, true); TaskList.Add(zoneTask); Task profileTask = _profileService.RefreshStore(true, true); TaskList.Add(profileTask); Task loadoutsTask = _loadoutService.RefreshStore(true, true); TaskList.Add(loadoutsTask); Task scrimActionTask = _rulesetManager.SeedScrimActionModels(); TaskList.Add(scrimActionTask); Task facilitiesTask = _facilityService.RefreshStore(true, true); TaskList.Add(facilitiesTask); Task facilityTypesTask = _facilityTypeService.RefreshStore(true, true); TaskList.Add(facilityTypesTask); Task vehicleTask = _vehicleService.RefreshStore(true, false); TaskList.Add(vehicleTask); Task vehicleTypeTask = _vehicleTypeService.SeedVehicleClasses(); TaskList.Add(vehicleTypeTask); Task deathTypeTask = _deathTypeService.SeedDeathTypes(); TaskList.Add(deathTypeTask); await Task.WhenAll(TaskList); _sqlScriptRunner.RunSqlDirectoryScripts("Views"); _logger.LogInformation($"Compiled all SQL Views"); cancellationToken.ThrowIfCancellationRequested(); } catch (Exception ex) { _logger.LogError($"Failed to seed database: {ex}"); } }
public async Task OnApplicationStartup(CancellationToken cancellationToken) { List <Task> TaskList = new List <Task>(); Task worldsTask = _worldService.RefreshStore(true, true); TaskList.Add(worldsTask); Task factionsTask = _factionService.RefreshStore(true, true); TaskList.Add(factionsTask); Task itemsTask = _itemService.RefreshStore(true, true); TaskList.Add(itemsTask); Task itemCategoriesTask = _itemCategoryService.RefreshStore(true, true); TaskList.Add(itemCategoriesTask); Task zoneTask = _zoneService.RefreshStore(true, true); TaskList.Add(zoneTask); Task profileTask = _profileService.RefreshStore(true, true); TaskList.Add(profileTask); Task loadoutsTask = _loadoutService.RefreshStore(true, true); TaskList.Add(loadoutsTask); Task scrimActionTask = _rulesetManager.SeedScrimActionModels(); TaskList.Add(scrimActionTask); Task facilitiesTask = _facilityService.RefreshStore(true, true); TaskList.Add(facilitiesTask); Task facilityTypesTask = _facilityTypeService.RefreshStore(true, true); TaskList.Add(facilityTypesTask); Task vehicleTask = _vehicleService.RefreshStore(true, false); TaskList.Add(vehicleTask); Task vehicleTypeTask = _vehicleTypeService.SeedVehicleClasses(); TaskList.Add(vehicleTypeTask); Task deathTypeTask = _deathTypeService.SeedDeathTypes(); TaskList.Add(deathTypeTask); await Task.WhenAll(TaskList); await _rulesetManager.SeedDefaultRuleset(); _sqlScriptRunner.RunSqlDirectoryScripts("Views"); }