コード例 #1
0
        internal async Task <int?> SetThroughPut(int requestUnits, string containerName, bool force = false)
        {
            _cosmosDbSettings.ContainerName = containerName;

            ICosmosRepository cosmosRepository = new CosmosRepository(_cosmosDbSettings);

            await cosmosRepository.EnsureContainerExists();

            int?currentRequestUnits = await cosmosRepository.GetThroughput();

            Console.WriteLine($"Container Name:{containerName} Throughput: Current:{currentRequestUnits} New:{requestUnits} Force:{force}");

            if (currentRequestUnits < requestUnits || force)
            {
                await cosmosRepository.SetThroughput(requestUnits);
            }

            return(currentRequestUnits);
        }