aspnet / DependencyInjection

[Archived] Contains common DI abstractions that ASP.NET Core and Entity Framework Core use. Project moved to https://github.com/aspnet/Extensions
Apache License 2.0
877 stars 320 forks source link

Add method to replace services with a new implementation type #619

Closed khellang closed 5 years ago

khellang commented 6 years ago

I exposed TryGetDescriptors as well. It's a method that I've found useful a number of times. Let me know if you want to make it private instead.

Closes https://github.com/aspnet/Home/issues/2328

aspnet-hello commented 6 years ago

This issue was moved to aspnet/Home#2327

aspnet-hello commented 6 years ago

Sorry I was a bad bot. Re-opening this PR.

davidfowl commented 6 years ago
khellang commented 6 years ago

Where are the overloads that take a factory? Why only implementation type?

Good point. I've only ever needed the overloads taking a type. I can add the factory overloads if you think they'd be valuable.

What's the behavior when you replace an implementation but there are many descriptors that exists for:

In that case, you'd end up with two registrations of IFoo, both resolving Foo3 as a singleton 🤔

muratg commented 5 years ago

We're closing this PR because no updates have been provided in a timely manner and we are unable to merge it.

We thank you for the contribution and look forward to collaborating more in the future.