Ninject with MVC3 RTM

笑着哭i 提交于 2019-12-02 01:25:10

Since ASP.NET MVC 3 Beta the IServiceLocator interface is replaced by IDependencyResolver. I'm not sure Ninject.MVC3 already has a release where they have implemented this interface.

Judging from the line DependencyResolver.SetResolver(new NinjectServiceLocator(kernel)) it appears they have not.

Here's a simple implementation of this interface for Ninject.

UPDATE: The Ninject.Web.Mvc library has a NinjectDependencyResolver class that extends from the IDependencyResolver interface. I think you should use this one (I do and everything works fine).

Remo Gloor

Download the dlls from here

https://github.com/ninject/ninject/archives/master

https://github.com/ninject/ninject.web.mvc/archives/master

Further more do not use Ninject.MVC3 all you need ist Ninject.Web.Mvc

I also have an article documenting same here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!