public async Task OnApplicationStartup(CancellationToken cancellationToken)
        {
            try
            {
                await _dbSeeder.SeedDatabase(cancellationToken);

                cancellationToken.ThrowIfCancellationRequested();

                List <Task> TaskList = new List <Task>();

                var scrimmableMapRegionsTask = _facilityService.SetUpScrimmableMapRegionsAsync();
                TaskList.Add(scrimmableMapRegionsTask);

                var worldsMapTask = _worldService.SetUpWorldsMap();
                TaskList.Add(worldsMapTask);

                var zonesTask = _zoneService.SetupZonesMapAsync();
                TaskList.Add(zonesTask);

                await Task.WhenAll(TaskList);

                cancellationToken.ThrowIfCancellationRequested();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed loading application data: {ex}");
            }
        }
        public async Task OnApplicationStartup(CancellationToken cancellationToken)
        {
            try
            {
                await _dbSeeder.SeedDatabase(cancellationToken);

                cancellationToken.ThrowIfCancellationRequested();

                List <Task> TaskList = new List <Task>();

                var seedDefaultRulesetTask = _rulesetManager.SeedDefaultRuleset();
                TaskList.Add(seedDefaultRulesetTask);

                var weaponCategoriesListTask = _itemCategoryService.SetUpWeaponCategoriesListAsync();
                TaskList.Add(weaponCategoriesListTask);

                var scrimmableMapRegionsTask = _facilityService.SetUpScrimmableMapRegionsAsync();
                TaskList.Add(scrimmableMapRegionsTask);

                var worldsMapTask = _worldService.SetUpWorldsMap();
                TaskList.Add(worldsMapTask);

                var zonesTask = _zoneService.SetupZonesMapAsync();
                TaskList.Add(zonesTask);

                await Task.WhenAll(TaskList);

                cancellationToken.ThrowIfCancellationRequested();

                await _rulesetManager.ActivateDefaultRulesetAsync();

                await _rulesetManager.SetUpActiveRulesetAsync();

                await _matchScorer.SetActiveRulesetAsync();
            }
            catch (Exception ex)
            {
                _logger.LogError($"Failed loading application data: {ex}");
            }
        }
Пример #3
0
        public async Task <IActionResult> SeedData()
        {
            var amountOfRows = await _DbSeeder.SeedDatabase();

            return(Ok($"Inserted {amountOfRows} rows into database."));
        }