コード例 #1
0
        public Task SetThroughputAsync(int throughput)
        {
            if (!ThroughputValidator.IsValidThroughput(throughput))
            {
                throw new ArgumentException("The provided throughput is not valid. Must be between 400 and 1000000 and in increments of 100.", nameof(throughput));
            }

            return(_container.ReplaceThroughputAsync(throughput));
        }
コード例 #2
0
        /// <summary>
        /// Sets the throughput (RU/s) for the database.
        /// </summary>
        /// <param name="throughput">The new throughput to set. Must be between 400 and 1000000 in increments of 100.</param>
        /// <returns></returns>
        public Task SetThroughputAsync(int throughput)
        {
            if (!ThroughputValidator.IsValidThroughput(throughput))
            {
                throw new ArgumentException("The provided throughput is not valid. Must be between 400 and 1000000 and in increments of 100.", nameof(throughput));
            }

            return(_cosmosClient.GetDatabase(_database.Model.DatabaseId).ReplaceThroughputAsync(throughput));
        }
コード例 #3
0
        /// <summary>
        /// Creates the Cosmos database and defined collections if not exists.
        /// </summary>
        /// <returns></returns>
        public Task CreateIfNotExistsAsync(CreateDbOptions options = null)
        {
            if (options != null && !ThroughputValidator.IsValidThroughput(options.Throughput))
            {
                throw new ArgumentException("The provided throughput is not valid. Must be between 400 and 1000000 and in increments of 100.");
            }

            return(CreateIfNotExistsInternalAsync(options));
        }
コード例 #4
0
        public void TestIsValidThoughput(int throughput, bool expected)
        {
            var isValid = ThroughputValidator.IsValidThroughput(throughput);

            Assert.Equal(expected, isValid);
        }