title: MVC Core Dependency Injection: Interface-Repository Generic Parameter Error
body: <p>I have read through many books and articles on stackoverflow.
  Still receiving error below. Here is my basic outline for Interface, Repository with Generic Parameter. I have AddTransient in my Startup.cs.</p>
  
  <p>In the controller, I am trying to refer to the Interface, without referring to the Repository name. I had the thing working without Generic Parameter. As soon as I implemented Generic Parameter, I receive error below. I want to refer to Interface without referring to Repository or the Model, since we may go from RelationalDB to MongoDB later, etc. How do I get rid of this error?</p>
  
  <p><strong>Interface:</strong></p>
  
  <pre><code>public interface IProductRepository&lt;T&gt;: IDisposable where T:class
  {
      IEnumerable&lt;T&gt; GetProductDetail();
  </code></pre>
  
  <p><strong>Repository:</strong></p>
  
  <pre><code>public class ProductRepository: IProductRepository&lt;ProductdbData&gt;
  {
       IEnumerable&lt;ProductdbData&gt; GetProductDetail(); 
  </code></pre>
  
  <p><strong>Startup.cs</strong></p>
  
  <pre><code>services.AddTransient(typeof(IProductRepository&lt;&gt;), typeof(ProductRepository));
  </code></pre>
  
  <p><strong>Controller Webpage Error:</strong></p>
  
  <pre><code>namespace CompanyWeb.Controllers
  {
      public class ProductController: Controller
      {
          private IProductRepository _productwebrepository; // this line gives error
  </code></pre>
  
  <p><strong>Error Message: 
  Error   CS0305  Using the generic type 'IProductRepository' requires 1 type arguments</strong>  </p>