I can’t seem to find an example of injecting controllers directly from a seperate project. Previously in Spring.net I would add the following to the Global.asax
ControllerBuilder.Current.SetControllerFactory(new SpringFactory);
and then simply add the entry to the xml
<object name=”Shared” type=”…”/>
Could someone please outline the steps I need to take to accomplish this with the latest version of Ninject and MVC3? or a link to an example?
Addtionally I was wanting to do something similair with the Views (put them in a seperate project), can Ninject help me with this?
Any help appreciated.
Have you tried using the
Ninject.Mvc3package? It will set up everything for you: http://nuget.org/List/Packages/Ninject.MVC3.Install it by typing:
Install-Package Ninject.Mvc3in the Package Manager Console. It will add a file under the App_Start folder, there you can modify what you want to inject.For the View part Ninject can help you if you have implemented your own
IViewPageActivatorthat you inject. But why do you want to have your views in a separate project? The views belongs to the web application and should be located in the web application project.