What is the best way to use Ninject with MVC 3 and how?

advertisements

What is the best way to use Ninject with MVC 3 and how ?

It is using a controller factory ? or using NinjectHttpApplication ?

How to get ninject for MVC 3 ? Ive looked around but i can't seem to figure out how to get the required ..mvc.dll

Any exemples would be helpful to me and others.

Thanks!


The best and simplest way to get Ninject for MVC 3 is adding the NuGet package Ninject.MVC3 using the NuGet Package Manager from within Visual Studio.

This will set up everything for you, add an App_Start folder to your application which contains NinjectMVC3.cs. At this point everything is already hooked up as Controller Factory thanks to WebActivator - you can just add your bindings in RegisterServices() or of course put them in a separate module.