title: Get DbContext's DbSet<T> where T is variable
body: <p>I have a DbContext looking somewhat like this:</p>
  
  <pre><code>class MyDbContext: DbContext
  {
      public DbSet&lt;Class1&gt; Set1 {get;set;}
      public DbSet&lt;Class2&gt; Set2 {get;set;}
      ...
  }
  </code></pre>
  
  <p>where Class1, Class2 ... : BaseClass<br>
  The thing is I'm reading data from xml and I use a dictionary that looks like this:</p>
  
  <pre><code>public class XmlNode
  {
      public Func&lt;BaseClass&gt; CreateEntity { get; set; }
      ...
  }
  
  public static Dictionary&lt;string, XmlNode&gt; Nodes = new Dictionary&lt;string, XmlNode&gt;()
  {
      ["Tag1"] = new XmlNode()
      {
  
          CreateEntity = () =&gt; new Class1(),
      }
  
      ...
  }
  </code></pre>
  
  <p>And then I have to compare the read entity to an existing table and maybe add it. But I can't find a way to get the approptiate table without making a different function for every Class I have. Is there a way to get a DbSet where Class is a variable?</p>