开发者

Resolving with Ninject in filters MVC2

开发者 https://www.devze.com 2023-01-26 08:50 出处:网络
Hey, I have been searching all over for a solution to injecting into action filters.I have found a few solutions but they were implemented with an older version of ninject/mvc.Has anyone found a simpl

Hey, I have been searching all over for a solution to injecting into action filters. I have found a few solutions but they were implemented with an older version of ninject/mvc. Has anyone found a simple solution to this problem? I have been blocked for a day trying to get a clean implementation.

I have looked at this solution but a lo开发者_开发知识库t of the functions he uses are deprecated in Ninject.


Ninjet.Web.Mvc has support for this and the source code comes with a sample application that has filter injection. See https://github.com/ninject/ninject.web.mvc. The only thing that you have to do is adding a porperty with the Inject attribute to your action filter.

MVC3 has even better support see http://www.planetgeek.ch/2010/11/13/official-ninject-mvc-extension-gets-support-for-mvc3/#more-2004

0

精彩评论

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

关注公众号