John Kalberer
John Kalberer

Reputation: 5790

Resolving with Ninject in filters MVC2

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 lot of the functions he uses are deprecated in Ninject.

Upvotes: 2

Views: 384

Answers (1)

Remo Gloor
Remo Gloor

Reputation: 32725

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

Upvotes: 2

Related Questions