Skip to content

New Autofac registration helper: UsingLoggingInterceptor #162

@jbatte47

Description

@jbatte47

As a developer, I want a convenience method that allows me to write code like:

builder.RegisterInstance(new MyClass)
  .As<IMyContract>()
  .UsingLoggingInterceptor();

So that I don't have to write code like this anymore:

builder.RegisterInstance(new MyClass)
  .As<IMyContract>()
  .EnableInterfaceInterceptors()
  .InterceptedBy(typeof(LoggingInterceptor));

Bonus points: make it work for registered classes as well (detect scenario and call EnableClassInterceptors instead), and consider making the method generic, a la:

builder.RegisterInstance(new MyClass)
  .As<IMyContract>()
  .UsingInterceptor<LoggingInterceptor>();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions