title: How to get DbSet from entity name in EF Core / .NET Core 2.0
body: <p>I have a <code>DbContext</code> with several <code>DbSet&lt;T&gt;</code> properties:</p>
  
  <pre><code>public virtual DbSet&lt;A&gt; A { get; set; }
  public virtual DbSet&lt;B&gt; B { get; set; }
  public virtual DbSet&lt;C&gt; C { get; set; }
  ...
  </code></pre>
  
  <p>In certain scenarios I must now be able to retrieve a specific DbSet with the entity name as string (e.g. when the user enters "A", I need to get the <code>Dbset&lt;A&gt;</code>).</p>
  
  <p>In previous EF versions, the following was possible:</p>
  
  <p><code>var dbset = Context.Set(Type.GetType(A));</code></p>
  
  <p>Is there a similar way to do so with the current versions of EF core? I've tried several ways to achieve that, but the only way I have it working at the moment is using a rather ugly switch/case and I would like to get rid of that.</p>
  
  <p>I've found several posts with similar issues around here, but all of them relate to early .NET Core versions or EF5 / EF6.</p>