Using Dapper and Postgresql - citext data type
You probably need to create create a CitextParameter which extends ICustomQueryParameter. This API allows you to pass an arbitrary DbParameter instance to Dapper - in this case it would be an instance of NpgsqlParameter with its NpgsqlDbType set to Citext.
Something like this should work:
class CitextParameter : SqlMapper.ICustomQueryParameter{ readonly string _value; public CitextParameter(string value) { _value = value; } public void AddParameter(IDbCommand command, string name) { command.Parameters.Add(new NpgsqlParameter { ParameterName = name, NpgsqlDbType = NpgsqlDbType.Citext, Value = _value }); }}
When you write the SQL query, you can cast the parameter value like cast(@param as citext).
in my case below worked correctly. (usr is a class object)
string sql = "select * from users where user_name = cast(@user_name as citext) and password = @password;";IEnumerable<users> u = cnn.Query<users>(sql, usr);
In your case, you can change the query like below and see if that works
string sql = @"select * from ""dbo"".""MyFunction""(cast(@schemaName as citext), cast(@tableName as citext));";