A Func<Page, bool>
is a delegate, which means that you are doing this in LINQ-to-Objects (i.e. in memory, in C #). .NET Strings case sensitive, so this applies to the case.
This version, however:
var res1 = dataContext.Persons.Any(p=>p.Name== personName);
uses IQueryable<T>
and expression trees; it will be executed as a TSQL filter that will apply database rules. What happens here depends on how your database is configured (depending on the database, it may be case sensitive or case sensitive).
If you want them both to use the same logic, notice the difference here:
Expression<Func<Page, bool>> predicate = (p) => p.Name== personName; var res2 = dataContext.Persons.Any(predicate);
Adding Expression<...>
makes this expression tree, not a delegate, so it is "composed" and executed in the database (via TSQL translation), just like:
var res1 = dataContext.Persons.Any(p=>p.Name== personName);
source share