Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orleans configurable via IConfiguration #6565

Closed
jason-bragg opened this issue May 29, 2020 · 2 comments · Fixed by #8764
Closed

orleans configurable via IConfiguration #6565

jason-bragg opened this issue May 29, 2020 · 2 comments · Fixed by #8764

Comments

@jason-bragg
Copy link
Contributor

Orleans uses Options and I Configuration but doesn't link the two. Out of the box a silo cannot be directly configured a IConfigurable source (say json) without developers writing custom conversion code (read from IConfig, then set options) to do so, which should not be necessary as options can be initialized from IConfig. The reason for this is that the various configuration hooks and extension functions do not take configuration sources as the underlying options calls do.

For instance, instead of just having:

    public static ISiloBuilder Configure<TOptions>(this ISiloBuilder builder, Action<TOptions> configureOptions) where TOptions : class
    {
        return builder.ConfigureServices(services => services.Configure(configureOptions));
    }

Which requires and action be written by the developer, wherein they must set the option values, if there were also overrides for reading from I config.. something like:

    public static ISiloBuilder Configure<TOptions>(this ISiloBuilder builder, IConfigurationSection section) where TOptions : class
    {
        return builder.ConfigureServices(services => services.Configure<TOptions>(section));
    }

and/or

    public static ISiloBuilder Configure<TOptions>(this ISiloBuilder builder, IConfigurationRoot configurationRoot) where TOptions : class
    {
        return builder.ConfigureServices(services => services.Configure<TOptions>(configurationRoot.GetSection(typeof(TOptions).Name)));
    }

Then using Orleans with IConfiguration (the expected pattern) would be much simpler and cleaner.

Note: The above examples are half baked at best. Please consider before settling on a general pattern.

@SebastianStehle
Copy link
Contributor

Is this really needed? No other Microsoft library supports this afaik.

And you can very easily implement it yourself like this...

builder.AddAzureMonitorTraceExporter(options =>
{
    config.GetSection("logging:applicationInsights").Bind(options);
});

It is from Open Telemetry but it is the idea that matters ;)

@ghost ghost added the stale Issues with no activity for the past 6 months label Dec 7, 2021
@ghost
Copy link

ghost commented Dec 7, 2021

We are marking this issue as stale due to the lack of activity in the past six months. If there is no further activity within two weeks, this issue will be closed. You can always create a new issue based on the guidelines provided in our pinned announcement.

@rafikiassumani-msft rafikiassumani-msft added enhancement and removed stale Issues with no activity for the past 6 months labels Dec 7, 2021
@ghost ghost added the Status: Fixed label Jan 9, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants