I'm using EF 4.3.1 Code First with a SQL Server CE 4 database, it works great it created all the tables and the database with no hassle
But now I'm getting this problem I'm querying the database using LINQ
using (var db = new PeopleContext())
{
var people = from e1 in db.People
where e1.Name.Contains("maria")
select e1;
}
I would like to get on the results each person which Name contains María
or Maria
or maría
or maria
- notice the accent in the i - í
I want an accent-insensitive and case-insensitive search
Thanks in advance for any help
Update: Ok, I found a way of doing this on .NET Side by using string.Compare()
string.Compare(string1, string2, CultureInfo.CurrentCulture,
CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase);
The IgnoreNonSpace flag will ignore accents and the IgnoreCase flag will ignore case.
SQL Server Compact supports only CI_AS (not CI_AI) - see http://msdn.microsoft.com/en-us/library/ms174596(v=sql.105).aspx - so you must use another database product, or store a searchable version of your data in another column