I'm totally a newbie with Ninject
and I tried to follow the tutorial by Shiju Varghese at his blog post about DI.
I did add reference of ninject.dll and Ninject.Web.Mvc.dll However, I got stuck as Visual Studio cannot resolve the function RegisterAllControllersIn....
protected override void OnApplicationStarted()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
// RegisterAllControllersIn could not be found!!
RegisterAllControllersIn(Assembly.GetExecutingAssembly());
}
I'm using Visual Studio 2010 Prof
, .Net 4
, MVC2
, Ninject 2.0.0.0 / 2.0.1.0 and Ninject Web.mvc extension
Based on the README for ninject.web.mvc it appears that the line
RegisterAllControllersIn(..)
is only needed for ASP.NET MVC 1
RegisterAllControllersIn
lives in Ninject.Web.MvcNinjectHttpApplication
You probably are not deriving your MVC application / global class from MvcApplication
[instead of HttpApplication
or similar].
Best way of searching stuff like this is to stick MVC, Ninject and Ninject.MVC into Reflector and do an F3-search
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With