aspnet/DependencyInjection

How can I get the previous dependency instance of the same type?

infinnie opened this issue · 5 comments

For example, when I wanted to inject a dependency that is my implementation of the type IMyInterface, I wanted my dependency to have access to the previously injected IMyInterface dependency instance. How could I achieve that?

It's not supported in this container implementation.

Whoops. Any plans for shimming that?

Not in the short term, it's been discussed in the past, see #340

rayao commented

I dealt with this with a generic interface like
public interface IChainComposed<TService> { TService Service { get; } }
And make the implementation class constructor has an IEnumerable<TService> parameter, and then chain all service instances there.

Eilon commented

Closing because there are no plans to implement this.