title: Dynamic Table Names in Linq to SQL
body: <p>Hi all I have a horrid database I gotta work with and linq to sql is the option im taking to retrieve data from. anywho im trying to reuse a function by throwing in a different table name based on a user selection and there is no way to my knowledge to modify the TEntity or Table&lt;> in a DataContext Query.</p>
  
  <p>This is my current code.</p>
  
  <pre><code>public void GetRecordsByTableName(string table_name){
  
  string sql = "Select * from " + table_name;
  var records = dataContext.ExecuteQuery&lt;/*Suppossed Table Name*/&gt;(sql);
  
  ViewData["recordsByTableName"] = records.ToList();
  }
  </code></pre>
  
  <p>I want to populate my ViewData with Enumerable records.</p>