private static async Task InitializeCosmosDb()

in Hands-on lab/lab-files/TransactionGenerator/Program.cs [468:488]


        private static async Task InitializeCosmosDb()
        {
            Database database = await _cosmosDbClient.CreateDatabaseIfNotExistsAsync(DatabaseName);
            
            // Create a partition based on the ipCountryCode value from the Transactions data set.
            // This partition was selected because the data will most likely include this value, and
            // it allows us to partition by location from which the transaction originated. This field
            // also contains a wide range of values, which is preferable for partitions.
            var containerProperties = new ContainerProperties(CollectionName, PartitionKey)
            {
                // The default indexing policy for newly created containers is set to automatic and enforces
                // range indexes for any string or number.
                IndexingPolicy = {Automatic = true}
            };

            // Create the container with a maximum autoscale throughput of 4000 RU/s. By default, the
            // minimum RU/s will be 400.
            var container = await database.CreateContainerIfNotExistsAsync(
                containerProperties: containerProperties,
                throughputProperties: ThroughputProperties.CreateAutoscaleThroughput(autoscaleMaxThroughput: 4000));
        }