public AccountController(IUserStore<ApplicationUser> userStore)
{
//uncommenting the following line, uses the correct context, but
//unit testing fails to work, as it is overwritten, so I need to use IoC
//to inject
//userStore = new UserStore<ApplicationUser>(new ApplicationDbContext());
UserManager = new UserManager<ApplicationUser>(userStore);
我的ninject绑定应该是什么样子?我能够编译的唯一东西看起来像下面这样,但是没有得到正确的上下文。我应该使用什么ninject绑定?
kernel.Bind<IUserStore<ApplicationUser>>().To<UserStore<ApplicationUser>>();
具有约束力的东西,而不是在注释掉线使用正确的上下文
这工作,但第二行是没有必要的,但我会相信你的话,我可能需要它。简单的谷歌搜索没有提供WithConstructorArgument的简单指南。我会继续寻找。 – WhiskerBiscuit
顺便说一句,你是什么意思的整个图表? – WhiskerBiscuit
您的整个依赖关系图。 A取决于依赖于C的B等等。在正确配置所有绑定后,当通过容器创建A时,B被注入到A中,C被注入到B. – cvbarros