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.
For .NET 3.1 register in ConfigureServices in 𝐒𝐭𝐫𝐚𝐭𝐮𝐩.𝐜𝐬
For latest versions of .NET(6.0 ,7.0) register in 𝐏𝐫𝐨𝐠𝐫𝐚𝐦.𝐜𝐬
#dotnetcore #dependency #dependencyinjection #entityframework #csharp #dotnet6