How can I use LIKE wildcard in postgre DB using Dapper? I have the following code:
string query = "SELECT name, index FROM article WHERE prefiks LIKE :prefix ;";
return conn.Query<myModel>(query , new { prefix = searchingValue }).ToArray();
Where searchingValue is a simple string. I tried few combinations which I already found:
return conn.Query<myModel>(query , new { prefix = "%" + searchingValue + "%" }).ToArray();
or
string query = "SELECT name, index FROM article WHERE prefix LIKE '%' || :prefix || '%'"
return conn.Query<myModel>(query , new { prefix = searchingValue }).ToArray();
But nothing works. I suppose that above solutions are fine for MS SQL but doesn't work under postgre;