From 3ad7765a49fd3417c9bb95288a21fc46dda4e0c4 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 21 Jan 2025 11:37:47 -0600 Subject: [PATCH 1/3] Bumped Dapr version to 1.15.0-rc02 Signed-off-by: Whit Waldo --- bindings/csharp/sdk/batch/batch.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/csharp/sdk/batch/batch.csproj b/bindings/csharp/sdk/batch/batch.csproj index 492bab613..1d43dc767 100644 --- a/bindings/csharp/sdk/batch/batch.csproj +++ b/bindings/csharp/sdk/batch/batch.csproj @@ -8,7 +8,7 @@ - + \ No newline at end of file From 9835c5ccff609ced1472b74ccd8b74b270a8141f Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Tue, 21 Jan 2025 11:39:45 -0600 Subject: [PATCH 2/3] Updated to reflect transition to DI registration over use of static builder Signed-off-by: Whit Waldo --- bindings/csharp/sdk/batch/program.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bindings/csharp/sdk/batch/program.cs b/bindings/csharp/sdk/batch/program.cs index 354d95410..3b9fde86d 100644 --- a/bindings/csharp/sdk/batch/program.cs +++ b/bindings/csharp/sdk/batch/program.cs @@ -31,6 +31,8 @@ limitations under the License. options.SupportedCultures = [invariantCulture]; }); +builder.Services.AddDaprClient(); + var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseDeveloperExceptionPage(); } @@ -38,13 +40,12 @@ limitations under the License. app.UseRequestLocalization(); // Triggered by Dapr input binding -app.MapPost("/" + cronBindingName, async () => +app.MapPost("/" + cronBindingName, async (DaprClient client) => { Console.WriteLine("Processing batch.."); string jsonFile = File.ReadAllText("../../../orders.json"); var ordersArray = JsonSerializer.Deserialize(jsonFile); - using var client = new DaprClientBuilder().Build(); foreach (Order ord in ordersArray?.orders ?? new Order[] { }) { var sqlText = $"insert into orders (orderid, customer, price) values ({ord.OrderId}, '{ord.Customer}', {ord.Price});"; @@ -65,5 +66,5 @@ limitations under the License. await app.RunAsync(); -public record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price); -public record Orders([property: JsonPropertyName("orders")] Order[] orders); \ No newline at end of file +public sealed record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price); +public saeled record Orders([property: JsonPropertyName("orders")] Order[] orders); \ No newline at end of file From deed0b98af0cae0036f57a699a193537585101c7 Mon Sep 17 00:00:00 2001 From: Whit Waldo Date: Wed, 22 Jan 2025 20:54:58 -0600 Subject: [PATCH 3/3] Fixed typo Signed-off-by: Whit Waldo --- bindings/csharp/sdk/batch/program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/csharp/sdk/batch/program.cs b/bindings/csharp/sdk/batch/program.cs index 3b9fde86d..75bf9fd26 100644 --- a/bindings/csharp/sdk/batch/program.cs +++ b/bindings/csharp/sdk/batch/program.cs @@ -67,4 +67,4 @@ limitations under the License. await app.RunAsync(); public sealed record Order([property: JsonPropertyName("orderid")] int OrderId, [property: JsonPropertyName("customer")] string Customer, [property: JsonPropertyName("price")] float Price); -public saeled record Orders([property: JsonPropertyName("orders")] Order[] orders); \ No newline at end of file +public sealed record Orders([property: JsonPropertyName("orders")] Order[] orders); \ No newline at end of file