what is the way to register a Generic class with 3 arguments
public interface ITest<T,V,VE>
{
}
public class TestRespository<T,V,VE>:ITest<T,V,VE>
{
}
i had registered like this
services.AddScoped(typeof(ITest<,,>), typeof(ITest<,,>));
but unable to get in Constructor as well as
service.GetService(typeof(ITest<TestClass, vTestClass, VETestClass>)) as ITest<TestClass, vTestClass, VETestClass>;
The problem is with call of AddScoped()
method. You should pass type of implementation in second argument, not the type of interface itself:
services.AddScoped(typeof(ITest<,,>), typeof(TestRespository<,,>));