title: Dynamic Where Linq to Entities
body: <p>I've been doing research on how to dynamically make queries for linq.  I'm creating a UI for a web application which allows them to select properties from a DB and set where clauses to build reports dynamically.  All of the questions I've seen on stack or other sites reference using Dynamic Linq and LinqKit to Solve the problem, example <a href="https://social.msdn.microsoft.com/Forums/vstudio/en-US/d37dbeb5-82d4-4f67-8715-cc314486e836/a-straight-forward-way-to-construct-a-dynamic-querydynamic-where-clause-in-lightswitch?forum=lightswitch" rel="nofollow">Here</a> .  However I can't find an solution to express the syntax.  </p>
  
  <pre><code>// This attempts to grab out a title whose from the Database whose
  // Copyright Date equals 2006
  propName = "CopyrightDate";
  Model.Titles.Where(t =&gt; t.GetType().GetProperty(propName).GetValue(t, null) == "2006");
  </code></pre>
  
  <p>I want to do something like this but in Linq to Entities.  Linq to entities doesn't support reflection like that, I do not want to pull out all of the data and run Linq to Object the DB is too Large.  Any Suggestions on how to write this in Dynamic Linq.    Bonus points if you can cast the type to the property type so It can be evaultuated with standard operators (== , > , &lt; , etc..).</p>