title: No mapping exists from ObjectParameter to a known managed provider native type
body: <p>I am in the process of building a WCF service using EF to a Microsoft SQL Server but keep getting the following error:</p>
  
  <blockquote>
    <p>Additional information: No mapping exists from object type System.Data.Objects.ObjectParameter to a known managed provider native type.</p>
  </blockquote>
  
  <p>On this query: </p>
  
  <pre><code>string ID = "XXID";
  string Sql = @"SELECT * FROM @Table WHERE " + ID + " LIKE '@SearchTerm'";
  ObjectParameter[] Parameters = new ObjectParameter[2];
  Parameters[0] = new ObjectParameter("Table", Table);
  Parameters[1] = new ObjectParameter("SearchTerm", SearchTerm);
  
  using (var Context = new XXEntities())
  {
      Context.Database.Connection.Open();
      IEnumerable&lt;string&gt; Query = Context.Database.SqlQuery&lt;string&gt;(Sql, Parameters);
  
      string[] Results = Query.ToArray();
      Context.Database.Connection.Close();
      return Results; 
  }
  </code></pre>
  
  <p>I have tested the query on SQL Server and it works as expected- returning the record of a matched ID. </p>