title: Dynamic Linq Query between dates
body: <p>I am trying to use <a href="https://www.nuget.org/packages/System.Linq.Dynamic/" rel="nofollow noreferrer">Dynamic Linq Query</a> to create a function that will compare a field between 2 dates.
  The function looks like this:</p>
  
  <pre><code>public static IQueryable&lt;T&gt; BetweenDates&lt;T&gt;(this IQueryable&lt;T&gt; models, DateTime startDate, DateTime endDate, string propertyName)
  {
      var start = new DateTime(startDate.Year, startDate.Month, startDate.Day, 0, 0, 1); // Set to 1 second past midnight
      var end = new DateTime(endDate.Year, endDate.Month, endDate.Day, 0, 0, 0); // Set to midnight
  
      return models.Where($"{ propertyName } =&gt; { start } &amp;&amp; { propertyName } &lt;= { end }");
  }
  </code></pre>
  
  <p>If I run this, I get an error:</p>
  
  <blockquote>
    <p>Expression expected</p>
  </blockquote>
  
  <p>but I can't figure out what is wrong.
  Has anyone done this before?</p>