I am using Entity Framework 6, MySQL, ASP.NET MVC.
The problem is this: when I search the form (my search view), the EF is differentiating capital from lowercase. When I query directly in MySQL, using SqlYog for example, it does not make any difference if I search in uppercase or lowercase, so I think it's something with EF. Can someone give a help ?
This is my code that receives the parameter (search text) and queries the database:
public dynamic GetAll(Func<TEntity, bool> predicate, int limit, ClassContexto contexto)
{
dynamic data = null;
try
{
data = limit == 0 ?
(from p in contexto.Set<TEntity>() select p).Where(predicate).ToList() :
(from p in contexto.Set<TEntity>() select p).Where(predicate).ToList().Take(limit);
}
catch (DbEntityValidationException e)
{
data = e.EntityValidationErrors;
foreach (var eve in e.EntityValidationErrors)
{
var x = eve.Entry.Entity.GetType().Name + " - - " + eve.Entry.State;
foreach (var ve in eve.ValidationErrors)
{
data = ve.PropertyName + "--" + ve.ErrorMessage;
}
}
}
catch (Exception erro)
{
try
{
data = erro.InnerException.ToString();
return data;
}
catch
{
data = erro.Message.ToString();
return data;
}
}
finally
{
}
return data;
}
In the bank, there is an "ANTONIO" record. If you search for "antonio", null
is returned.
How can I change this?