title: How to create a very dynamic LinqToEntity query?
body: <p>I need to build a very dynamic Linq query over a varying number of tables.
  For example, I have the related tables:<br> 
  <b>Table_A</b><br>
   - ID<br>
   - Name<br>
   - Desc<br></p>
  
  <p><b>Table_B</b><br>
   - ID<br>
   - Table_A_ID<br>
   - Name<br>
   - Desc</p>
  
  <p><b>Table_C</b><br>
   - ID<br>
   - Table_B_ID<br>
   - Name<br>
   - Desc</p>
  
  <p>I have a dictionary with information about the table dependencies containing:<br>
  &nbsp;&nbsp;<i>tableName, parentTableName, foreignKey, parentPK</i><br>
  Example:<br> 
  &nbsp;&nbsp;"Table_B", "Table_A", "Table_A_ID", "ID"<br>
  &nbsp;&nbsp;"Table_C", "Table_B", "Table_B_ID", "ID"</p>
  
  <p>-> tableInfo["Table_B"].ForeignKey will return "Table_A_ID" etc.</p>
  
  <p>Now the user can select which columns he wants to see.<br>
  Examples:
  <li><b>Table_B.Name, Table_C.Desc</b><br>
  &nbsp;or
  <li><b>Table_A.Name, Table_B.Name</b><br>
  &nbsp;or
  <li><b>Table_A.Name, Table_B.Name, Table_B.Desc, Table_C.Name</b><br></p>
  
  <p>This selection will is available in another list:<br>
  E.g for selection 3:<br>
  viewInfo["Table_A"] contains "Name"<br>
  viewInfo["Table_B"] contains "Name", "Desc"<br>
  viewInfo["Table_C"] contains "Name"<br></p>
  
  <p>How do I dynamic create a query just using the needed tables and fields to get the desired result?</p>