Linq 查询某个字段为null的数据

如tb_flag 数据结构如下:
flag int null

不能使用:flag==null
生成的SQL语句为 where flag=null
 
建议使用:可空类型 用Nullable<T>.Equals(字段,值)
var query=from f in db.tb_flag
where Nullable<int>.Equals(f.flag,null) select f; 
生成的SQL语句为 where flag is null
原文地址:https://www.cnblogs.com/huangjianwu/p/4538656.html