A DotNet Raider

My adventures in the .NET world!
posts - 49, comments - 12, trackbacks - 0

My Links

News

Website View Martino Bordin's profile on LinkedIn

Archives

Post Categories

luglio 2023 Blog Posts

Dapr - Create a Dapr service

In order to use Dapr with C#, you just have to create a new ASP.NET Core Web API Project and reference the Nuget package Dapr.AspNetCore Once done, just go in the Program.cs and chain the method AddDapr() after the method AddControllers(): builder.Services.AddControllers().AddDapr(); In addition to that, just call these methods to register the Pub\Sub building block: app.MapSubscribeHandler(); app.UseCloudEvents(); At this point, you can inject the DaprClient, in your controller or services, to interact with the several APIs of Dapr. public CustomersController(DaprClient daprClient) { this.daprClient = daprClient; } We then can run the application along with Dapr sidecar using...

posted @ lunedì 3 luglio 2023 07:19 | Feedback (0) | Filed Under [ Dapr Microservices ]

Powered by:
Powered By Subtext Powered By ASP.NET