开发者

Difference between use of a controller factory and NinjectHttpApplication?

开发者 https://www.devze.com 2023-02-06 09:50 出处:网络
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.SetController

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(开发者_Python百科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 ?


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/

0

精彩评论

暂无评论...
验证码 换一张
取 消