Search code examples
c#entity-frameworknon-ascii-characters

Ignoring accents while searching the database using Entity Framework


I have a database table that contains names with accented characters. Like ä and so on.

I need to get all records using EF4 from a table that contains some substring regardless of accents.

So the following code:

myEntities.Items.Where(i => i.Name.Contains("a")); 

should return all items with a name containing a, but also all items containing ä, â and so on. Is this possible?


Solution

  • If you set an accent-insensitive collation order on the Name column then the queries should work as required.