0
我有此代码错误ninject类型“T”必须是可转化为“T”,以便以通用方法用它作为一个参数“T”
public class NinjectControllerFactory : DefaultControllerFactory
{
private IKernel ninjectKernel;
public NinjectControllerFactory()
{
ninjectKernel = new StandardKernel();
AddBindings();
}
protected override IController GetControllerInstance(
RequestContext requestContext, Type controllerType)
{
return controllerType == null
? null
: (IController)ninjectKernel.Get(controllerType);
}
private void AddBindings()
{
ninjectKernel
.Bind<ICollection>().
To<ListOfProcess.ConnectionLogic.ConnectionLogic>();
}
}
并且在最后一行下一个错误: 类型“T”必须可转换为“T”才能在通用方法中将其用作参数“T”。