Ninject and MVC3: Dependency injection to action filters

前端 未结 2 2081
小蘑菇
小蘑菇 2020-12-08 04:59

I\'ve found loads of inconclusive articles and questions on how to do property injection on an ActionFilter in ASP.NET MVC3 using Ninject.

Could someone give me a cl

2条回答
  •  轮回少年
    2020-12-08 05:41

    In my opinion there is a better solution than using filter attributes. See my blogposts about an alternative way of declaring filters using Ninject. It does not require property injection and uses constructor injection instead:

    http://www.planetgeek.ch/2010/11/13/official-ninject-mvc-extension-gets-support-for-mvc3/ http://www.planetgeek.ch/2011/02/22/ninject-mvc3-and-ninject-web-mvc3-merged-to-one-package/

提交回复
热议问题