♾️ ASP.NET Dependency Injection: Handle multiple implementations for one interface with delegate

preview_player
Показать описание
When you have multiple implementations of an interface, how do you resolve them at runtime? in this video, I show you how to handle it by delegate. leave a comment and share your solution!

#dotnet #aspnetcore #dependencyinjection #aspnetcorewebapi #csharp

LinkedIn Profile:
Рекомендации по теме
Комментарии
Автор

It was awesome Saeed. Thank you for your specific videos and tips, especially on LinkedIn.🙏🙏🙏

vahidalizadeh
Автор

Nice approach, we can also use generics in most cases

guilhermeestimo
Автор

That' great. It's very helpful.

arashch
Автор

It is nice...in scenario of 2 implementations. Just feels like a lot of boilerplate if you would start using this broadly in big solutions.

CodeThatVoid
Автор

May I know, what are benefits of using delegates over serviceLocatorPattern to resolve service ?

unluckieeidiot
Автор

I implemented this already too in my project

ugochukwuumerie
Автор

quick question... if the scoped injection are for foo and bar and the strategy returns foo or bar, then the interface is redundant and there is no reason to use it. or i am missing Something?

stamone
Автор

Thanks and new implementation with .net 8 ??? :)

Totti