Dependency Injection in .NET 8: Keyed Service Registrations 🚀

preview_player
Показать описание
Today, we want to look at Keyed Service Registrations for Dependency Injection in .NET 8. It's a new feature coming with .NET 8 in November 2023.

00:00 Introduction
00:11 Dependency Injection before .NET 8
00:49 Dependency Injection using Keyed Service Registrations (.NET 8)
04:24 Conclusion

🔥 C#/.NET Bootcamp: The Fundamentals & more (Code FRIENDS10 for 10% OFF)*

📌 .NET Developer Roadmap

📌 YouTube Playlists:

✅ SUBSCRIBE FOR MORE VIDEOS

🚀 CONNECT & SUPPORT

* Affiliate Link: I earn a small commission at no additional cost
Рекомендации по теме
Комментарии
Автор

Will you use Keyed Services in your .NET applications? Do you think they're useful? 🤔

ClaudioBernasconi
Автор

2:46 I get the use case, but Unity DI and Autofac had this functionality for a while. Also I don't like the use of a IServiceProvider in the service constructor. This makes it so the controller has intimate knowledge about the implementation type it uses. And if the controller is built to use a specific implementation type, then you might as well just register this specific type in the DI container and resolve it in the constructor.

IMHO passing the serviceProvider in the constructor defeats the whole point of DI.

TheWolverine
Автор

Thanks for creating these short videos Claudio. Very useful and informative however, I must ask do you know why this feature was created in the first place? What was the necessity of this Keyed service is not clear to me. Can you please provide some MS link reg this?

vivekkaushik