Created
October 12, 2019 00:20
-
-
Save ealsur/9765c4ad03bb14c279bebfd9a514309e to your computer and use it in GitHub Desktop.
Azure Cosmos DB V3 SDK - Bulk tasks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Container container = cosmosClient.GetContainer("myDb", "myCollection"); | |
// Assuming your have your data available to be inserted or read | |
List<Task> concurrentTasks = new List<Task>(); | |
foreach(Item itemToInsert in ReadYourData()) | |
{ | |
concurrentTasks.Add(container.CreateItemAsync(itemToInsert, new PartitionKey(itemToInsert.MyPk))); | |
} | |
await Task.WhenAll(concurrentTasks); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment