I need to perform a query from DB using EF 6, but i would like to filter a string ignoring accents or removing diacritics.
For example: in the DB I have
tblPerson{ Id = 1, Name = "José" }
I maded the next query:
var result = _dbContext.Person
.Where(x => x.Name.Contains(filter))
.OrderByDescending(x => x.Id)
.Take(20)
.ToList();
The query above throw the next exception:
Exception has occurred: CLR/System.InvalidOperationException An exception of type 'System.InvalidOperationException' occurred in Microsoft.EntityFrameworkCore.dll but was not handled in user code: 'The LINQ expression 'DbSet<Contacto>
.Where(c => (Nullable<int>)c.Deleted == (Nullable<int>)0 && c.Nombres + " " + c.PrimerApellido + " " + c.SegundoApellido
.RemoveDiacritics().Contains(__busqueda_0))' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.