I have this interface:
public interface IRepository<TDomain, TBusiness>
where TDomain : class
where TBusiness : class
{...}
And this class:
public class Repository<TDomain, TBusiness> : IRepository<TDomain, TBusiness>
where TDomain : class
where TBusiness : class
{...}
And when i bind in with ninject, something like:
Kernel.Bind(typeof(IRepository<>))
.To(typeof(Repository<>))
.InRequestScope();
And have an error "Incorrect number of type parameters in ...". When I have only one generic in type everything works fine. Have anyone solution to fix this problem?
This has nothing to do with Ninject, the error you are getting is a C# compiler error. That's because the correct way to specify a type with two generic arguments is the following:
typeof(IRepository<,>)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.