I am trying to filter a list by a searchstring. It says in the doc on the blue note that:
- IQueryable gives you the database provider implementation of Contains.
- IEnumarable gives you the .NET Framework implementation of Contains
- The default setting of SQL-server instances is case-insensitive.
- Using "ToUpper" to make an explicit case-insensitive call should be avoided because it has a performance penalty.
My filtering is as follows:
IQueryable<ApplicationUser> customers = from u in _context.Users
where (u.Customer != null && u.IsActive)
select u;
if (!String.IsNullOrEmpty(searchString))
{
customers = customers.Where(s => s.Email.Contains(searchString));
}
This solution however is case-sensitive which I don't really understand why since I'm using IQueryable so it should use the database provider implementation which is case-insensitive by default? I'm using EF Core 2 and currently just running a local MSSQLLocalDB