title: Dynamically select column name using Linq to Entities (EF6)
body: <p>I want to encapsulate common scenarios when using EF6.
  Here's an example:</p>
  
  <pre><code>   public class StringRequest : DbRequestProperty
     {
        public string Name { get; set; }
        public bool? ExactMatch { get; set; }
  
        protected override bool IsValid()
        {
           return !string.IsNullOrWhiteSpace(Name);
        }
  
        private bool RequestExactMatch()
        {
           return ExactMatch.HasValue &amp;&amp; ExactMatch.Value;
        }
  
        protected override IQueryable&lt;T&gt; Execute&lt;T&gt;(IQueryable&lt;T&gt; original, string propertyName)
        {
           return RequestExactMatch()
              ? original.Where(o =&gt; GetProperty&lt;string&gt;(o, propertyName) == Name)
              : original.Where(o =&gt; GetProperty&lt;string&gt;(o, propertyName).Contains(Name));
        }
     }
  </code></pre>
  
  <p>But GetProperty can't be converted to a query.
  So I'm thinking on selecting dynamically the column using "propertyName".</p>
  
  <pre><code>  protected override IQueryable&lt;T&gt; Execute&lt;T&gt;(IQueryable&lt;T&gt; original, string propertyName)
    {
       return RequestExactMatch()
          ? original.Where(o =&gt; GetColumnByName&lt;string&gt;(propertyName) == Name)
          : original.Where(o =&gt; GetColumnByName&lt;string&gt;(propertyName).Contains(Name));
    }
  </code></pre>
  
  <p>Is this possible?
  Thanks in advance.</p>