bli*_*eis 7 nhibernate linq-to-nhibernate
how can i achieve this query with Nhibernate Linq?
var l = session.CreateQuery("from Auswahl a where a.Returnkey is not null").List<Auswahl>();
Run Code Online (Sandbox Code Playgroud)
i tried this but it always returns an empty list.
var l = session.Linq<Auswahl>()
.Where(item => !String.IsNullOrEmpty(item.Returnkey))
.Select(item => item)
.ToList();
Run Code Online (Sandbox Code Playgroud)
你有没有尝试过:
var l = session.Linq<Auswahl>()
.Where(item => item.Returnkey != null && item.Returnkey != "")
.Select(item => item)
.ToList();
Run Code Online (Sandbox Code Playgroud)
我不确定使用String.IsNullOrEmpty是否可行,它还会检查两个条件 - 如果它是NULL并且它是一个空白的空字符串,那么它将如何被转换为SQL?可能值得查看SQL事件探查器以查看它生成的原始SQL查询.
| 归档时间: |
|
| 查看次数: |
3418 次 |
| 最近记录: |