title: How to OR combine two Expression for EF core
body: <p>I already had a look at the following question, but it didn't gian much traction and the problem remains unsolved.
  <a href="https://stackoverflow.com/questions/17597201/how-to-combine-or-two-expression-trees">How to combine (OR) two expression trees</a></p>
  <p>How do you <code>or</code>-concatenate two <code>Expression&lt;Func&lt;T, bool&gt;&gt;</code>.</p>
  <p>let's consider the simplest case:</p>
  <pre><code>var fulltext = &quot;some text&quot;;
  
  private Expression&lt;Func&lt;User, bool&gt;&gt; FulltextSearch(string fulltext) {
  
      Expression&lt;Func&lt;User, bool&gt;&gt; left = t =&gt; t.Name.Contains(fulltext)
      Expression&lt;Func&lt;User, bool&gt;&gt; right = t =&gt; t.Description.Contains(fulltext)
      return Expression.Lambda&lt;Func&lt;Task, bool&gt;&gt;(Expression.Or(left.Body, right.Body), left.Parameters);
  }
  
  var users = dbContext.Users
      .Where(FulltextSearch(&quot;name xy&quot;))
      .ToList();
  
  </code></pre>
  <p><em>this is a simplified example!</em></p>
  <p>This ends in an error</p>
  <pre><code>System.InvalidOperationException: The LINQ expression 'DbSet&lt;User&gt;()
      .Where(t =&gt; t.Name.Contains(__fulltext_0) | t.Description.Contains(__fulltext_0))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'...
  
  </code></pre>
  <p>But you can easily write this query like this and it works:</p>
  <pre><code>var users = dbContext.Users
      .Where(u =&gt; u.Name.Contains(fulltext) || u.Description.Contains(fulltext))
      .ToList()
  </code></pre>
  <p>So how do you combine two Expression&lt;Func&lt;T,bool&gt;&gt; into one such that ef core can translate it into SQL?</p>