This should work:-
Bind(typeof(IRepository<>)).To(typeof(Repository<>));
where:-
IRepository<> is an interface of the form:-
public interface IRepository<T> where T :class
{
//...
}
Repository<> is a class of the form:-
public class Repository<T>:IRepository<T> where T :class
{
//...
}
But how to do it in XML configuration using Ninject.Extensions.Xml?
It does not work.
You can find out what the name of the type is by doing
typeof(IRepository<>).FullNameand then configure the XML as follows:I haven't used the XML extensions for Ninject before, but that should work