title: Way to dynamically get repositories without a dependency on a DI container
body: <p>I have a class that returns a repository (read only) using a generic method this is to reduce the number of repository classes I need to inject into classes in my business layer. It also allows me to add and use a new repo anywhere I have this wrapper class simply by adding a repo which implements <code>IGenericReadRepo&lt;T&gt;</code> as this will be registered in unity using the line  <code>Container.RegisterType(typeof(IGenericReadRepository&lt;&gt;), typeof(GenericReadRepository&lt;&gt;), new TransientLifetimeManager());</code>. However this has is dependent on unity being the DI container. This smells to me.</p>
  
  <pre><code>public class ReadRepositoryWrapper : IReadRepositoryWrapper
  {
      private IUnityContainer _unityContainer;
  
      public ReadRepositoryWrapper(IUnityContainer container)
      {
          _unityContainer = container;
      }
  
      public IGenericReadRepository&lt;T&gt; GetReadRepository&lt;T&gt;() where T : class
      {
           return _unityContainer.Resolve&lt;IGenericReadRepository&lt;T&gt;&gt;();
      }
  }
  </code></pre>
  
  <p>Can anyone think of a way to implement the <code>GetReadRepository&lt;T&gt;</code> without a the dependency on unity while not introducing any new dependencies. Or can someone think of another way to get repositories without having bloated constructors or a dependency on my context.   </p>