dapr / dotnet-sdk

Dapr SDK for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to configure ActionRuntimeOptions via a Func<IServiceProvider>

dariogriffo opened this issue · comments

Describe the feature

Provide an extension method of ServiceCollection to allow to configure the actor runtime from a function with a IServiceProvider as parameter
This will allow the configuration to be read from any app configuration. Example

services.AddActors(sp => sp.GetRequiredService<IConfiguration>().Bind<ActorRuntimeOptions>());

I wonder if it'd be enough to just have AddActors() always do an implicit bind (or, only if no Action<ActorRuntimeOptions> argument is passed) rather than an overload just to return a service provider, just to pull the configuration.

My problem is at the moment I have to get the dapr configuration out of the air or build a service provider with the configuration registered to get the configuration and use it in the next line when registering Dapr.