Autofac.Extras.DynamicProxy 8.1.0

Autofac.Extras.DynamicProxy

Interceptor and decorator support for Autofac via Castle DynamicProxy.

Build status codecov NuGet

Please file issues and pull requests for this package in this repository rather than in the Autofac core repo.

Quick Start

First, create your interceptor:

public class CallLogger : IInterceptor
{
  TextWriter _output;

  public CallLogger(TextWriter output)
  {
    _output = output;
  }

  public void Intercept(IInvocation invocation)
  {
    _output.Write("Calling method {0}.", invocation.Method.Name);
    invocation.Proceed();
    _output.WriteLine("Done: result was {0}.", invocation.ReturnValue);
  }
}

Then register your type to be intercepted:

var builder = new ContainerBuilder();
builder.RegisterType<SomeType>()
       .As<ISomeInterface>()
       .EnableInterfaceInterceptors();
builder.Register(c => new CallLogger(Console.Out));
var container = builder.Build();
var willBeIntercepted = container.Resolve<ISomeInterface>();

You can read more details in the documentation.

Get Help

Need help with Autofac? We have a documentation site as well as API documentation. We're ready to answer your questions on Stack Overflow or check out the discussion forum.

No packages depend on Autofac.Extras.DynamicProxy.

Release notes are at https://github.com/autofac/Autofac.Extras.DynamicProxy/releases

.NET 10.0

.NET 8.0

.NET Standard 2.0

.NET Standard 2.1

Version Downloads Last updated
8.1.0 1 08/17/2026
8.0.1 0 07/09/2026
8.0.0 0 06/24/2026
7.1.0 209 01/21/2024
7.0.0 14 03/01/2025
6.0.1 13 03/01/2025
6.0.0 14 03/01/2025
5.0.0 16 03/01/2025
4.5.0 13 03/01/2025
4.4.0 18 03/01/2025
4.3.0 16 03/01/2025
4.2.1 11 03/01/2025
4.2.0 16 03/01/2025
4.1.0 12 03/01/2025
4.0.1 14 03/01/2025
4.0.0 19 03/01/2025
4.0.0-beta8-231 8 03/05/2025
4.0.0-beta8-227 13 03/05/2025