Rushino
Rushino

Reputation: 9505

Difference between use of a controller factory and NinjectHttpApplication?

Using Ninject 2 MVC 3. Correct me if i am wrong but ive seen two way of using Ninject in an MVC 3 application. We can use a new controller factory which is like ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory()); or using NinjectHttpApplication and then configure the kernel.

I was wondering what difference between use of a controller factory and NinjectHttpApplication to configure the binding for DI?

And what are the best place to setup DI ?

Upvotes: 3

Views: 1605

Answers (1)

Remo Gloor
Remo Gloor

Reputation: 32725

NinjectHttpApplication calls ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory()) internally.

But additionally it sets up various bindings and provides many new features. In other words it's less work and adds new features. Best you read my blog post about the MVC3 extension. http://www.planetgeek.ch/2010/11/13/official-ninject-mvc-extension-gets-support-for-mvc3/

Upvotes: 4

Related Questions