I am using LINQ to search through one of my Entity Framework tables and find a \"group\" based on the name. The name is a string and appears to be Unicode (says it is in the
The string comparison with StringComparison.OrdinalIgnoreCase
works in memory or with IEnumerable
. You are trying to use it with IQueryable
, but the provider of your queryable does not understand it.
This works for me:
db.Users.FirstOrDefault(
s => s.Username.Equals(username, StringComparison.OrdinalIgnoreCase)
);