Filter injection with autofac in MVC3
I have a set of global filters, each derived from IGlobalFilter
//knows how to add itself in filter collection
abstract class GlobalFilter : IGlobalFilter {}
class MyFilter : GlobalFilter, IRequestFilter{}
public class GlobalFilterActionInvoker : ControllerActionInvoker {}
Here is my autofac registration
builder.RegisterType<MyFilter>().As<IGlobalFilter>();
builder.RegisterType<GlobalFilterActionInvoker>().As<IActionInvoker();开发者_StackOverflow
builder.RegisterControllers(assemblies).PropertiesAutoWired().InjectActionInvoker();
For what ever the reason my GlobalFilterActionInvoker's GetFilters method is not being called.
Constructors of these components are being called indicating that autofac registration is successful!
How can troubleshoot this issue?
Found the problem. We are using Glimpse (server side debugger similar to firebug). They have their own controllactioninvoker. Which is overriding my autofac registration!!!
精彩评论