From dccae023a432deff6cecd3b5613422a2a21e92d0 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Mon, 23 Oct 2023 04:52:01 -0500 Subject: [PATCH 1/2] Added example for retrieving bulk deserialized items matching PR #1173 in dotnet-sdk repo. Signed-off-by: Whit Waldo --- .../state-management/howto-get-save-state.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md index 9d8f08e93..621e71b7b 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md +++ b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md @@ -566,6 +566,33 @@ To launch a Dapr sidecar for the above example application, run a command simila dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 dotnet run ``` +The above example will return a `BulkStateItem` with the serialized format of the value you saved to state. If you would prefer that the value be deserialized by the SDK across each of your bulk response items, you can instead use the following: + +```csharp +//dependencies +using Dapr.Client; +//code +namespace EventService +{ + class Program + { + static async Task Main(string[] args) + { + string DAPR_STORE_NAME = "statestore"; + //Using Dapr SDK to retrieve multiple states + using var client = new DaprClientBuilder().Build(); + IReadOnlyList> mulitpleStateResult = await client.GetBulkStateAsync(DAPR_STORE_NAME, new List { "widget_1", "widget_2" }, parallelism: 1); + } + } + + class Widget + { + string Size { get; set; } + string Color { get; set; } + } +} +``` + {{% /codetab %}} {{% codetab %}} From 047e71cb3cf858931a43a135c1e41ad91d474e1b Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 24 Oct 2023 16:56:22 -0500 Subject: [PATCH 2/2] Update daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Signed-off-by: Whit Waldo --- .../building-blocks/state-management/howto-get-save-state.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md index 621e71b7b..fad6afbfd 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md +++ b/daprdocs/content/en/developing-applications/building-blocks/state-management/howto-get-save-state.md @@ -566,7 +566,7 @@ To launch a Dapr sidecar for the above example application, run a command simila dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 dotnet run ``` -The above example will return a `BulkStateItem` with the serialized format of the value you saved to state. If you would prefer that the value be deserialized by the SDK across each of your bulk response items, you can instead use the following: +The above example returns a `BulkStateItem` with the serialized format of the value you saved to state. If you prefer that the value be deserialized by the SDK across each of your bulk response items, you can instead use the following: ```csharp //dependencies