You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/how-to-migrate-from-bulk-executor-library.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn how to migrate your application from using the bulk executor
4
4
author: ealsur
5
5
ms.service: cosmos-db
6
6
ms.topic: conceptual
7
-
ms.date: 04/06/2020
7
+
ms.date: 04/24/2020
8
8
ms.author: maquaran
9
9
---
10
10
@@ -22,13 +22,13 @@ Enable bulk support on the `CosmosClient` instance through the [AllowBulkExecuti
22
22
23
23
Bulk support in the .NET SDK works by leveraging the [Task Parallel Library](https://docs.microsoft.com/dotnet/standard/parallel-programming/task-parallel-library-tpl) and grouping operations that occur concurrently.
24
24
25
-
There is no single method that will take your list of documents or operations as an input parameter, but rather, you need to create a Task for each operation you want to execute in bulk.
25
+
There is no single method in the SDK that will take your list of documents or operations as an input parameter, but rather, you need to create a Task for each operation you want to execute in bulk, and then simply wait for them to complete.
26
26
27
27
For example, if your initial input is a list of items where each item has the following schema:
If you want to do bulk import (similar to using BulkExecutor.BulkImportAsync), you need to have concurrent calls to `CreateItemAsync` with each item value. For example:
31
+
If you want to do bulk import (similar to using BulkExecutor.BulkImportAsync), you need to have concurrent calls to `CreateItemAsync`. For example:
@@ -42,7 +42,7 @@ And if you want to do bulk *delete* (similar to using [BulkExecutor.BulkDeleteAs
42
42
43
43
## Capture task result state
44
44
45
-
In the previous code examples, you have created a concurrent list of tasks, and called the `CaptureOperationResponse` method on each of those tasks. This method is an extension that lets us maintain a *similar response schema* as BulkExecutor, by capturing any errors and tracking the [request units usage](request-units.md).
45
+
In the previous code examples, we have created a concurrent list of tasks, and called the `CaptureOperationResponse` method on each of those tasks. This method is an extension that lets us maintain a *similar response schema* as BulkExecutor, by capturing any errors and tracking the [request units usage](request-units.md).
@@ -52,7 +52,11 @@ Where the `OperationResponse` is declared as:
52
52
53
53
## Execute operations concurrently
54
54
55
-
After the list of tasks are defined, wait until they are all complete. You can track the completion of the tasks by defining the scope of your bulk operation as shown in the following code snippet:
55
+
To track the scope of the entire list of Tasks, we use this helper class:
0 commit comments