dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

`services.AddDaprClient()` should allow fluent registration

Open tillig opened this issue 3 years ago • 1 comments

Describe the proposal

The Dapr.AspNetCore package has an extension for registering the Dapr client using services.AddDaprClient() here. Traditionally extensions like this will return the IServiceCollection provided so registrations can be chained:

services
  .AddSingleton<MyType>()
  .AddTransient<OtherType>();

Unfortunately, the current method returns void so it cuts off the fluent registration support.

I'd like to propose changing that to return IServiceCollection to follow the registration conventions and allow fluent registration.

This would be a breaking API change from a binary perspective but not a source perspective - folks upgrading without recompiling would break, but if you recompile it wouldn't require any code changes. Potentially it could be scheduled for the next major release?

tillig avatar Jan 19 '22 21:01 tillig

@tillig - Thanks for this issue! However, this is technically a binary breaking change. I'm going to start making a v2.0 milestone for this SDK. Once we reach a critical mass of issues in it, we can start making a new major version for the SDK.

halspang avatar Jan 25 '22 21:01 halspang