Skip to content

Instantly share code, notes, and snippets.

@ealsur
Created October 12, 2019 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ealsur/9765c4ad03bb14c279bebfd9a514309e to your computer and use it in GitHub Desktop.
Save ealsur/9765c4ad03bb14c279bebfd9a514309e to your computer and use it in GitHub Desktop.
Azure Cosmos DB V3 SDK - Bulk tasks
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