title: The LINQ expression could not be translated and will be evaluated
body: <p>My code:</p>
  
  <pre><code>public static IQueryable&lt;ServicesData&gt; Query(DbContext dbc, string path1 = null, string path2 = null, string path3 = null) =&gt;
      dbc.ServicesData.Where(sd =&gt; SQLmatch(sd.Path1, path1) &amp;&amp; SQLmatch(sd.Path2, path2) &amp;&amp; SQLmatch(sd.Path3, path3));
  
  static bool SQLmatch(string match, string pattern) {
      if (match is null) match = "";
      if (pattern is null) pattern = "";
      bool wildcard = pattern.Contains("%") || pattern.Contains("_");
      return wildcard ? EF.Functions.Like(match, pattern) : object.Equals(match, pattern);
  }
  
  using (var dbc = new DbContext()) {
      var q = Query(dbc, "User", "%").ToList();
  </code></pre>
  
  <p>Using latest EFcore 3.0 this fails with:</p>
  
  <blockquote>
    <p>Error generated for warning
    'Microsoft.EntityFrameworkCore.Query.QueryClientEvaluationWarning: The
    LINQ expression 'where ((SQLmatch([sd].Path1, __path1_0) AndAlso
    SQLmatch([sd].Path2, __path2_1)) AndAlso SQLmatch([sd].Path3,
    __path3_2))' could not be translated and will be evaluated locally.'. This exception can be suppressed or logged by passing event ID
    'RelationalEventId.QueryClientEvaluationWarning' to the
    'ConfigureWarnings' method in 'DbContext.OnConfiguring' or
    'AddDbContext'.</p>
  </blockquote>
  
  <p>I would appreciate any help with this.</p>
  
  <p>EDIT</p>
  
  <p>It seems the problem is with the function call, if I put the code in SQLmatch into a single expression like this:</p>
  
  <pre><code>public static IQueryable&lt;ServicesData&gt; Query(DbContext dbc, string path1 = null, string path2 = null, string path3 = null) =&gt;
      dbc.ServicesData.Where(sd =&gt; 
      ((path1 ?? "").Contains("%") || (path1 ?? "").Contains("_") ? EF.Functions.Like((sd.Path1 ?? ""), (path1 ?? "")) : object.Equals((sd.Path1 ?? ""), (path1 ?? "")))
      &amp;&amp; ((path2 ?? "").Contains("%") || (path2 ?? "").Contains("_") ? EF.Functions.Like((sd.Path2 ?? ""), (path2 ?? "")) : object.Equals((sd.Path2 ?? ""), (path2 ?? "")))
      &amp;&amp; ((path3 ?? "").Contains("%") || (path3 ?? "").Contains("_") ? EF.Functions.Like((sd.Path3 ?? ""), (path3 ?? "")) : object.Equals((sd.Path3 ?? ""), (path3 ?? ""))));
  </code></pre>
  
  <p>it works ! </p>
  
  <p>Why can't EFCore process the code in a separate function ?</p>