Skip to content

autofac/Autofac.Owin

Repository files navigation

Autofac.Owin

ASP.NET OWIN integration for Autofac.

Build status

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

Quick Start

To take advantage of Autofac in your OWIN pipeline:

  • Reference the Autofac.Owin package from NuGet.
  • Build your Autofac container.
  • Register the Autofac middleware with OWIN and pass it the container.
public class Startup
{
  public void Configuration(IAppBuilder app)
  {
    var builder = new ContainerBuilder();
    // Register dependencies, then...
    var container = builder.Build();

    // Register the Autofac middleware FIRST. This also adds
    // Autofac-injected middleware registered with the container.
    app.UseAutofacMiddleware(container);

    // ...then register your other middleware not registered
    // with Autofac.
  }
}

Check out the Autofac OWIN integration documentation for more information.

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.