Ant*_*lev 8 nhibernate coalesce queryover
我想要提出的是这样的表达方式:
var result = Session.QueryOver<Foo>().OrderBy(f => f.UpdatedAt ?? f.CreatedAt);
Run Code Online (Sandbox Code Playgroud)
果然,这不起作用.在T-SQL中粗略相当于此
... order by coalesce(f.UpdatedAt, f.CreatedAt)
Run Code Online (Sandbox Code Playgroud)
在NHibernate QueryOver中进行"合并"的犹太方法是什么?
.OrderBy(Projections.SqlFunction("coalesce",
NHibernateUtil.DateTime,
Projections.Property<Foo>(x => x.UpdatedAt),
Projections.Property<Foo>(x => x.CreatedAt)))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2202 次 |
| 最近记录: |