Ejemplo n.º 1
0
        public async Task DoWorkAsync(CancellationToken cancellationToken)
        {
            // Bug with IHostedService
            await Task.Yield();

            var items  = new List <Item>();
            var allIds = _fileLoader.GetIDs();

            foreach (var raidName in EnumHelpers.ToEnumerable <RaidInstance>())
            {
                if (allIds.ContainsKey(raidName))
                {
                    foreach (var itemId in allIds[raidName])
                    {
                        var item = Item(
                            await _itemApiClient
                            .ItemId(Convert.ToInt32(itemId))
                            .Namespace("static-classic-us")
                            .Locale("en_US")
                            .Execute(),
                            raidName
                            );

                        items.Add(item);
                        Console.WriteLine($"Item: {item.Name} imported.");
                    }
                }
            }

            _factory.Item.CreateMany(items);
            Console.WriteLine("Finished ingesting item data.");
        }