I am trying to use ASP.NET MVC 3 and Ninject 2.2 to inject a logger object into a custom ActionFilterAttribute.
I am able to get this to work if I mark each control
You might find the following blog post useful. So in your RegisterServices
method simply:
private static void RegisterServices(IKernel kernel)
{
kernel.Bind().To();
kernel.BindFilter(FilterScope.Global, 0);
}
and to bring the BindFilter
extension method into scope don't forget to add a proper using
directive:
using Ninject.Web.Mvc.FilterBindingSyntax;