I am using Ninject 2.2 and I am trying to set a binding for an open generic that takes two type arguments. According to this answer by qes, the correct syntax for binding IRepository<T> to Repository<T> is as follows:
Bind(typeof(IRepository<>)).To(typeof(Repository<>));
The above syntax works fine if the IRepository accepts only one type argument, but breaks if it takes more (gives a compile-time error Using the generic type 'Repository<T,U>' requires 2 type arguments .)
How can I bind IRepository<T,U> to Repository<T,U> ?
Thank.
c # ninject-2
Daniel Liuzzi Jul 19 2018-11-11T00: 00Z
source share