Successfully added
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
- Collations and case sensitivity - EF Core | Microsoft Learn
- Collation Definitions | Microsoft Learn
- SQL Server collations | Microsoft Learn
Resources
Referenced in:
Leave a Comment
All fields are required. Your email address will not be published.
Comments