Ninject with MVC3 RTM

前端 未结 2 701
清酒与你
清酒与你 2021-01-22 01:16

I\'ve upgraded MVC3 from RC2 to RTM. We were using Ninject 2.1.0.76, but things stopped working once I upgraded. So I used the NuGet manager to get the latest Ninject, Ninject.M

相关标签:
2条回答
  • 2021-01-22 01:39

    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).

    0 讨论(0)
  • 2021-01-22 01:48

    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

    0 讨论(0)
提交回复
热议问题