Ninject with ASP.NET MVC series
- How to use Ninject with ASP.NET MVC
- How to use Ninject to inject dependencies into ASP.NET MVC ActionFilters
- Extending Ninject to inject dependencies into Action Filters
- Ninject.FilterInjector v1.5: now injecting inside all filters
The first version of my tiny FilterInjector included only the action invoker for ActionFilters.
But ASP.NET MVC has four different filters:
- Action Filters: executed before and after an Action is executed
- Result Filters: executed before and after the ActionResult returned by the Action is executed
- Authorization Filters: executed before an Action is executed, to verify that the current request is authorized
- Exception Filters: executed when a unhandled exception happens during the execution of the request
Now, thanks to Owen Evans which kindly sent me a patch, the Ninject.FilterInjector can also inject dependencies into all the four kind of filters.
You can download the latest version from my personal Google Code repository, together with a sample ASP.NET MVC website that uses all the aforementioned filters. The instruction to use it in your web applications are outlined in my previous post: Extending Ninject to inject dependencies into Action Filters.