title: Dynamic dependency injection of a generic class
body: <p>I'm pretty new to the .Net world and I faced a problem that I couldn't find a solution to and I would like you to help me with it please.</p>
  
  <p>I have a generic class that implements a generic interface and when I was implementing the dependency injection I didn't know how I can make it dynamic.</p>
  
  <p>For example:</p>
  
  <pre><code>services.AddSingleton&lt;IGenericRepository&lt;Game&gt;, GenericRepository&lt;Game&gt;&gt;();
  </code></pre>
  
  <p>I have multiple classes that i want to pass to the generic class/interface (<strong>Game</strong> is one of them) and I know that I have to repeat this line for every single one of them but i was wondering of there is any way to make this dynamic.</p>
  
  <p>Thank you.</p>