title: How do I inject a repository into a custom MembershipProvider using AutoFac
body: <p>I created a custom membership provider</p>
  
  <pre><code>public class MyMembership : MembershipProvider
  {
      private IRepository&lt;User&gt; Repo;
  }
  </code></pre>
  
  <p>I figured out how to inject MyMembership using autofac:</p>
  
  <pre><code>builder.Register(c =&gt; Membership.Provider);
  </code></pre>
  
  <p>However, this doesn't work if I have a constructor that takes an IRepository (it only calls the parameterless constructor.)  I tried doing changing from a private field to a public property and calling:</p>
  
  <pre><code>builder.Register(c =&gt; Membership.Provider).AutoWireProperties();
  </code></pre>
  
  <p>The problem is, MembershipProvider doesn't have a Repo property, it's only my class.</p>
  
  <p>For the time being, I've not injected anything, and just created an empty constructor where I simply create a new instance of my Repo.  But it makes it harder for testing.</p>
  
  <p>So, is there any way that I can use AutoFac to inject my MyMembership, and have it use the injected Repo?</p>