Using property injection instead of constructor injection

后端 未结 5 1020
时光取名叫无心
时光取名叫无心 2021-01-04 09:47

Long story short, I\'m trying to use ELMAH with MVC 2 and Ninject, and I need to use parameterless constructors. I created an initial post about it here: Using a parameterle

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 10:08

    As Daniel T. in the above comment posted, you should check out Ninject.Web.Mvc. If you use the NinjectHttpApplication in that project, it will autowire everything for you, so that when the NinjectControllerFactory constructs a new controller, it will call Inject() for you to fill the property injections.

提交回复
热议问题