0
我在Ninject.MVC RegisterServices以下行:Ninject.Extensions.Factory:無法找到結合
kernel.Load(new NinjectBllModule());
kernel.Bind<IMembershipLogicFactory>().ToFactory();
和我的模塊裏面:
Bind<IUserLogic<LoginUser>>().To<UserLogic>();
Bind<IRoleLogic<SimpleRole, LoginUser>>().To<RoleLogic>();
和我IMembershipLogicFactory:
public interface IMembershipLogicFactory
{
IUserLogic<TUser> GetUserLogic<TUser>() where TUser : UserBase;
IRoleLogic<TRole, TUser> GetRoleLogic<TRole, TUser>() where TRole : RoleBase<TUser> where TUser : UserBase<TRole>;
}
但是當我注入IMembershipLogicFactory並調用GetUserLogic()時,我得到以下e rror:
Error activating IUserLogic{LoginUser}
No matching bindings are available, and the type is not self-bindable.
Activation path:
1) Request for IUserLogic{LoginUser}
我似乎無法找到我做錯了什麼。
oooh,我錯過了。它是否寫在文檔的某個地方?它可以「關閉」嗎? – TDaver