title: C# PredicateBuilder Entities: The parameter 'f' was not bound in the specified LINQ to Entities query expression
body: <p>I needed to build a dynamic filter and I wanted to keep using entities. Because of this reason I wanted to use the PredicateBuilder from albahari.</p>
  <p>I created the following code:</p>
  <pre><code>var invoerDatums = PredicateBuilder.True&lt;OnderzoeksVragen&gt;();
  var inner = PredicateBuilder.False&lt;OnderzoeksVragen&gt;();
  
  foreach (var filter in set.RapportInvoerFilter.ToList())
  {
      if(filter.IsDate)
      {
          var date = DateTime.Parse(filter.Waarde);
          invoerDatums = invoerDatums.Or(o =&gt; o.Van &gt;= date &amp;&amp; o.Tot &lt;= date);
      }
      else
      {
          string temp = filter.Waarde;
          inner = inner.Or(o =&gt; o.OnderzoekType == temp);
      }
  }
  
  invoerDatums = invoerDatums.And(inner);
  var onderzoeksVragen = entities.OnderzoeksVragen
                                 .AsExpandable()
                                 .Where(invoerDatums)
                                 .ToList();
  </code></pre>
  <p>When I ran the code there was only 1 filter which wasn't a date filter. So only the inner predicate was filled. When the predicate was executed I got the following error.</p>
  <blockquote>
  <p>The parameter 'f' was not bound in the
  specified LINQ to Entities query
  expression.</p>
  </blockquote>
  <p>While searching for an answer I found the following <a href="https://docs.microsoft.com/en-us/archive/blogs/meek/linq-to-entities-combining-predicates" rel="nofollow noreferrer">page</a>. But this is already implemented in the LINQKit.</p>
  <p>Does anyone else experienced this error and know how to solve it?</p>