I'm using EF and i would like to make a search on field Name, this search must ignore character - and space and the case
on my table i have
id Name
1 Jean -philippe
when i'm make the search on my resqust sometime i have jeanphilippe
, some times jean philippe
I need to match this with the record on db like:
await repository.FindAsync(m=>m.Name.ToLower().Replace("-", string.Empty).Trim()==request.Name.ToLower().Replace("-", string.Empty).Trim())
public async Task<User> FindAsync(Expression<Func<User, bool>> match)
{
return await _databaseContext.user.FirstOrDefaultAsync(match).ConfigureAwait(false);
}
but i have EF error
The LINQ expression 'DbSet<user> where (.....) could not be translated.
How can i resolve this please?