Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional registration for interceptors #42

Open
tillig opened this issue Oct 8, 2020 · 0 comments
Open

Conditional registration for interceptors #42

tillig opened this issue Oct 8, 2020 · 0 comments

Comments

@tillig
Copy link
Member

tillig commented Oct 8, 2020

Problem Statement

Based on autofac/Autofac#1211 - it may be interesting to have the ability to conditionally enable interception based on a lambda expression. This does somewhat overlap with #29.

Desired Solution

I imagine the usage would be like:

builder
  .RegisterAssemblyTypes(typeof(Program).Assembly)
  .AsClosedTypesOf(typeof(ICommandHandler<,>))
  .EnableInterfaceInterceptors(t => t.HasSpecificAttributeICareAbout())
  .InterceptedBy(typeof(LoggingInterceptor));

That is, you could act on the registration based on the type being registered. (Honestly, this part needs some work. I haven't thought it all the way through. It may be there's a better way to go here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant