title: Get Entity Object from string using reflection
body: <p>I am able to obtain an object set with this code:</p>
  
  <pre><code>string tableName = "States";
  var test = db.GetType().GetProperty(tableName).GetValue(db, null);
  
  //this returns {System.Data.Objects.ObjectSet&lt;FmlaModel.State&gt;}
  </code></pre>
  
  <p>However, I would like to first find the <b>EntityObject</b> <code>FmlaModel.State</code>, so that I can explicitly name my variable type (like <code>ObjectSet&lt;EntityObject&gt;</code> instead of <code>var</code>), and so that I can use this to tell my form (TableEditor, see below) what type of EntityObject we are using.</p>
  
  <p>Is there a way I can do this using reflection?  I have searched quite a bit, but have not found anything that works yet...
  <br/><br/><br/>
  <b>EDIT:</b>
  My goal is to be able to have a db table containing the names of entity objects we will be able to edit.  The names will be loaded into a combobox, and when one is selected, I will create an instance of my "Table Editor" form with something like</p>
  
  <pre><code>TableEditor&lt;myEntityObject&gt; tableEditor 
       = new TableEditor&lt;myEntityObject&gt;(myEntitySet&lt;myEntityObject&gt;);
  </code></pre>
  
  <p>My "Table Editor" class looks like this:</p>
  
  <pre><code>public partial class TableEditor&lt;TEntity&gt; : Form
      where TEntity : EntityObject
  {
      public TableEditor(ObjectSet&lt;TEntity&gt; something)
      {
      ...
  </code></pre>