MVC3 + Ninject - How to?

前端 未结 1 920
南方客
南方客 2020-12-03 11:14

I\'ve just started playing with IoC containers and therefore chosed Ninject.

After several hours of sweat and tears I still cant figure out how to setup my MVC3 appl

相关标签:
1条回答
  • 2020-12-03 11:45

    You are mixing an own dependency resolver with the MVC extension. I'd suggest either going with your own dependency resolver or with using the MVC extension but not both. When using the MVC extension you have to use OnApplicationStarted instead of Application_Start.

    See http://www.planetgeek.ch/2010/11/13/official-ninject-mvc-extension-gets-support-for-mvc3/ and have a look at the SampleApplication that comes with the source code of the MVC extension https://github.com/ninject/ninject.web.mvc.

    Also the fix is not used anymore when you use the current version for the build server: http://teamcity.codebetter.com


    UPDATE: The Ninject.MVC3 package continues to be updated and works OOTB against MVC4 RTM (and RC). See this page in the wiki for details.

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