To clarify, I am using the same code to support multiple databases.
For SqlServer, that has case-insensitive querying, the following query would suffice:
var qry = from p in db.Person select p where p.name == 'John';
However, for PostgreSql, I would have to write
var qry = from p in db.Person select p where p.name.ToLower() == 'John'.ToLower();
I would end up with this rather ugly code:
if (postgres)
{
qry = from p in db.Person select p where p.name.ToLower() == 'John'.ToLower();
}
else
{
qry = from p in db.Person select p where p.name == 'John';
}
I am looking for a solution where I do not change the query, but it will generate different Sql, depending on the database dialect.
I looked at FuncionMappings, but I couldn't find out how to create a function mapping for operators, such as == > < <= >=