title: Inject DbContext with Autofac
body: <p>I have the following EntityFramework context:</p>
  
  <pre><code>public class Context : DbContext, IDbContext {
  }
  </code></pre>
  
  <p>Where IDbContext is the following:</p>
  
  <pre><code>public interface IDbContext {
    DbEntityEntry Entry(Object entity);
    IEnumerable&lt;DbEntityValidationResult&gt; GetValidationErrors();
    Int32 SaveChanges();
    Task&lt;Int32&gt; SaveChangesAsync();
    Task&lt;Int32&gt; SaveChangesAsync(CancellationToken cancellationToken);
    DbSet Set(Type entityType);
    DbSet&lt;TEntity&gt; Set&lt;TEntity&gt;() where TEntity : class;
  } // IDbContext
  </code></pre>
  
  <p>What is the correct way to configure DbContext injection with Autofac?</p>
  
  <p>With StructureMap I had the following:</p>
  
  <pre><code>For&lt;IDbContext&gt;().Use(x =&gt; new Context());
  </code></pre>