title: Cannot filter data on server using Linq, EF Core, Npgsql, Postgres
body: <p>I tried to google a solution, as well as I read documentation.
  So, I have trouble with filtering my entity this way:</p>
  <pre><code>// Raises the exception
  MyUser myUser = _sqlContext.MyUsers
      .Where(user =&gt; user.UserLogin.ToLower() == userLogin.ToLower())
      .ToList()
      .FirstOrDefault();
  
  // Raises the exception
  MyUser myUser = _sqlContext.MyUsers
      .Where(user =&gt; user.UserLogin.ToLower() == userLogin.ToLower())
      .ToList()
      .FirstOrDefault();
  
  // Raises the exception, too
  MyUser myUser = _sqlContext.MyUsers
      .Where(user =&gt; user.UserLogin == userLogin)
      .FirstOrDefault();
  
  // Raises the exception, too
  MyUser myUser = _sqlContext.MyUsers
      .FirstOrDefault(user =&gt; user.UserLogin == userLogin);
  </code></pre>
  <p>I receive the following exception:</p>
  <blockquote>
  <p>The LINQ expression 'DbSet
  .Where(p =&gt; p.UserLogin.ToLower() == __ToLower_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
  either AsEnumerable(), AsAsyncEnumerable(), ToList(), or
  ToListAsync(). See <a href="https://go.microsoft.com/fwlink/?linkid=2101038" rel="nofollow noreferrer">https://go.microsoft.com/fwlink/?linkid=2101038</a> for
  more information.</p>
  </blockquote>
  <p>The list of users can be really big, so this in no option to call <code>ToList()</code> before <code>Where()</code> to force client-side filtering. In contrary, I need EF to build a query with WHERE, and return to client only filtered values.</p>
  <p>My application uses ASP.NET Core 3.1 as well as EF Core 3.1.5. It doesn't work too if I remove ToLower().
  How can I make this work?</p>
  <p>UPD:
  The problem is in custom getter/setter of user.UserLogin. Here Is the part of model:</p>
  <pre><code>public class MyUser
  {
      internal string _userLogin { get; set; }
  
      public string UserLogin
      {
          get =&gt; _userLogin;
          set =&gt; _userLogin = value.ToLower();
      }
  }
  </code></pre>