EF Core by Patrik

Case-Sensitive Query in EF Core

To do a case-sensitive search in EF Core you can use an explicit collation in a query like

var customers = context.Customers
.Where(c => EF.Functions.Collate(c.Name, "SQL_Latin1_General_CP1_CS_AS") == "John")
.ToList();

Note: EF Core does not support operators on in-memory collections other than simple Contains with primitive values.

References

Resources

Comments

Leave a Comment

All fields are required. Your email address will not be published.