title: Dependency Injection of open generics with arguments
body: <p><a href="https://stackoverflow.com/questions/39320265/how-to-inject-dependencies-of-generics-in-asp-net-core">This</a> article talks about how to register Generic interfaces in .Net Core. However I have a generic interface which has multiple arguments and am having trouble figuring out registeration and constructor injection.</p>
  <p>My Interface has 4 arguments</p>
  <pre><code>public class TestImplementation 
  {
      // Try to inject IRepository here ??????
      public TestImplementation(.......)
      {
          ...
      }
  }
  
  public class Repository : IRepository&lt;Test1, Test2, Test3, Test4&gt; 
  {
      ...
  }
  
  public interface IRepository&lt;T, U, V, W&gt; where T : ITemplate1 where U : ITemplate2,...  
  {
      ...
  }
  </code></pre>
  <p>If I try to inject the Interface to any class, it gives me error as the interface doesnt get resolved even using below code in other part of the code</p>
  <pre><code>services.GetService(typeof(IRepository&lt;,,,&gt;))
  </code></pre>
  <p>I tried using constructor injection but it makes compiler unhappy (Unable to resolve service for type '....Interface....' while attempting to activate xxxx) as I want to keep the Interface open. I however resolve the interface in the code</p>