I’m using Ninject 2.2, and I’m trying to setup a binding for an open generic that takes two type arguments. According to this answer by qes, the correct syntax to bind IRepository<T> to Repository<T> is this:
Bind(typeof(IRepository<>)).To(typeof(Repository<>));
The above syntax works perfectly if IRepository takes just one type argument, but breaks if it takes more (gives a Using the generic type 'Repository<T,U>' requires 2 type arguments compile time error.)
How can I bind IRepository<T,U> to Repository<T,U>?
Thanks.
Try that….