c# - 为什么linq to postgresql使用tolower出现 "IS Null"

标签 c# linq postgresql linq-to-sql

以下 Linq 代码:

db.Where(t => t.ToLower().Equals(name.ToLower()))

生成以下 postgresql 查询:

SELECT "Extent1"."Name"
FROM "Custom" AS "Extent1"
WHERE lower("Extent1"."Name") = lower(@__linq__0) OR 
      lower("Extent1"."Name") IS NULL AND  lower(@__linq__0) IS NULL

为什么查询包含“IS NULL”条件?

最佳答案

可能是因为你的名字字符串变量可以为空,与表的值相同。 不确定 postgress 中是否为 null == null

关于c# - 为什么linq to postgresql使用tolower出现 "IS Null",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39042324/

相关文章:

c# - 记录和恢复应用程序状态以快速启动 .NET 应用程序

c# - 如何在 C#/ASP 中的单例中使用作用域依赖

c# - 以下 sql 查询的 linq 等价物是什么

postgresql - Postgres : incorrect sorting if timestamp in smtp format

postgresql - 地理服务器错误 : function postgis_lib_version()

c# - 如何在 for 循环中等待 x 秒 C# - unity

c# - OpenFileDialog 可以接收文件名 *.* 吗?

asp.net - 使用相同变量 with/if 语句绑定(bind)不同的 LINQ 数据源

c# - 将 foreach 循环转换为 Linq 表达式

sql - 无法引用联合之外的列