开发者

Filter injection with autofac in MVC3

开发者 https://www.devze.com 2023-03-21 23:28 出处:网络
I have a set of global filters, each derived from IGlobalFilter //knows how to add itself in filter collection

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!!!

0

精彩评论

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

关注公众号