title: Property Injection with Autofac
body: <p>I want to use Autofac for property injection. Here's my setup:</p>
  
  <pre><code>public partial class Startup
  {
      public void Configuration(IAppBuilder app)
      {
          var builder = new ContainerBuilder();
  
          builder.RegisterControllers(typeof(MvcApplication).Assembly);
  
          builder.RegisterType&lt;TeamManagerContext&gt;().PropertiesAutowired();
  
          var container = builder.Build();
          DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
  
          app.UseAutofacMiddleware(container);
          app.UseAutofacMvc();
  
          ConfigureAuth(app);
      }
  }
  </code></pre>
  
  <p>BaseController:</p>
  
  <pre><code>public class BaseController : Controller
  {
      /// &lt;summary&gt;
      /// Application DB context
      /// &lt;/summary&gt;
      public TeamManagerContext TeamManagerContext { get; set; }
  }
  </code></pre>
  
  <p>TeamManagerContext is always null (never injected). I've spent quite some time looking online without any further indication of what might be wrong.</p>
  
  <p>Any ideas?</p>