How to Register Open Generic in .NET Core Dependency Injection
Dec 17, 2022
In this topic we would cover
- How to create a Open Generic
- Right way to register Dependency Injection
If you have a generic interface and its generic implementation like we mostly do when we make a generic repository for CRUD operations and you want to register its dependency injection at startup, then there is a simple way of registering the DI.
1. For .NET 3.1 register in Configure Services in ๐๐ญ๐ซ๐๐ญ๐ฎ๐ฉ.๐๐ฌ
2. For latest versions of .NET(6.0 ,7.0) register in ๐๐ซ๐จ๐ ๐ซ๐๐ฆ.๐๐ฌ
Help the author in growing
- Subscribe my Weekly .NET Newsletter of C#/.NET
- Follow me OR Clap at least 50 times
- Get exclusive .NET Questions & Answers by becoming a Patreon