示例#1
0
        private async Task AddNewProductsAsync(CancellationToken stoppingToken)
        {
            int v = Random.Next(10);

            logger.LogInformation($"Add {v} new products");
            for (int i = 0; i < v; i++)
            {
                if (stoppingToken.IsCancellationRequested)
                {
                    return;
                }
                var product = CreateNewProduct();
                await Warehouse.AddNewProductAsync(product, Random.Next(100));
            }
        }