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