使用 dapper.contrib,我不断收到错误:'42P01: relation "tblproduct" does not exist'
.
我相信这是因为 postgresql 区分大小写。实体本身具有 的模式注释'[Table("tblProduct")]'
。
我找不到为什么生成的 sql 会使用小写的表名?我正在使用'SqlMapperExtensions.TableNameMapper'
来强制案例,但这也不起作用。我错过了什么吗?谢谢
public ICollection<Product> GetAll(int count)
{
if (SqlMapperExtensions.TableNameMapper != null)
return null;
SqlMapperExtensions.TableNameMapper = (type) =>
{
return "tblProduct";
};
using (var connection = new NpgsqlConnection(connectionString))
{
connection.Open();
return connection.GetAll<Product>().Take(count).ToList();
}
}