Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Overload Configure with access to IServiceProvider #218

Closed
fredrikhr opened this issue Jul 19, 2017 · 3 comments
Closed

Overload Configure with access to IServiceProvider #218

fredrikhr opened this issue Jul 19, 2017 · 3 comments

Comments

@fredrikhr
Copy link

IServiceCollection support adding ServiceDescriptors with a factory func, rather than an actual instance. It would be helpful, if Configure() would provide an overload where the IConfiguration instance is obtained from the serviceProvider. Currently you cannot configure options when you do not have access to the IConfiguration instance when you call Configure(). This might be the case if you have the IConfiguration stored in the DI container.

@fredrikhr
Copy link
Author

Proposed solution: #219

@tuespetre
Copy link

@couven92 with 2.0 at least, and using the WebHostBuilder, the ConfigureServices method of WebHostBuilder has an overload that can receive a WebHostBuilderContext that exposes the Configuration.

@shirhatti
Copy link

Implement IConfigureOptions instead of calling .Configure()
Your concrete implementation can depend on whatever services you need including IServiceProvider

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants