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

Named parameters for built in Microsoft DI Container #2937

Closed
satyajit-behera opened this issue Feb 5, 2020 · 2 comments
Closed

Named parameters for built in Microsoft DI Container #2937

satyajit-behera opened this issue Feb 5, 2020 · 2 comments

Comments

@satyajit-behera
Copy link

While using Microsoft Built In Dependency Injection, need of one feature often comes up:
Passing Parameters to Resolve during runtime.

Autofac provides this as in the example below.
var reader = scope.Resolve<ConfigReader>(new NamedParameter("configSectionName", "sectionName"));

In my opinion, this one feature will make the container complete in many aspects to use for any application that we create.

Is it still available and I am missing it how to use it, Or can it be included in some future release Or is there any work around to implement this?

Thanks

@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/aspnetcore Feb 5, 2020
@dmytrohridin
Copy link

dmytrohridin commented Apr 20, 2020

@satyajit-behera seems this feature request was raised several times and if I correctly remember - there was a comment that such an approach is some kind of anti-pattern and container will not be support this feature (but maybe things will change)
https://github.com/dmytrohridin/DependencyInjectionNamedExtensions
I implement for my several projects extensions, it's in prerelease state and testing, but you can try and submit issue if needed

@analogrelay
Copy link

Triage: This isn't something we plan to do in the built-in container. Features we add to the built-in container are likely to be depended-upon by app developers and libraries, which means we have to take extreme care to ensure we support features that most external containers support.

The recommended approach here is to use a container that supports the features your app needed.

@ghost ghost locked as resolved and limited conversation to collaborators May 30, 2020
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

4 participants