Skip to content

Conditional registration for interceptors #42

@tillig

Description

@tillig

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions