title: Correct usage of Repository Factory pattern?
body: <p>My repository pattern is setup like this:</p>
  
  <pre><code>public interface IRepository&lt;T&gt; where T : class {}
  
  public abstract class Repository&lt;C, T&gt; : IRepository&lt;T&gt; 
      where C : DbContext, IBaseContext 
      where T : class, IEntity 
  {}
  
  public interface ICustomerRepository : IRepository&lt;Customer&gt; 
  {//specific methods here}
  
  public class CustomerRepository : Repository&lt;MyContext, Customer&gt;, ICustomerRepository
  </code></pre>
  
  <p>I added the following method in my UoW class (and interface):</p>
  
  <pre><code>public TRepository GetRepository&lt;TEntity, TRepository&gt;() 
      where TEntity : class, IEntity 
      where TRepository : IRepository&lt;TEntity&gt;
  {
      object[] args = new object[] { (IDatabaseFactory&lt;MyContext&gt;)databaseFactory };
      return (TRepository)Activator.CreateInstance(typeof(TRepository), args);
  }
  </code></pre>
  
  <p>And in my service I try to get the repository doing the following:</p>
  
  <pre><code>var customerRepository = uow.GetRepository&lt;Customer, CustomerRepository&gt;();
  </code></pre>
  
  <p>In Autofac i'm using InstancePerRequest. So the UoW and the repository instances are created per request and disposed afterwards. Do I still need to implement caching of the repositories?</p>
  
  <p>Is this the correct way to use repository factory?</p>
  
  <p><strong>NOTE</strong></p>
  
  <p>My UoW and repositories are located in a 'DAL' assembly, my services are in a different 'Service' assembly. </p>