开发者

equivalent of hql coalesce in linq-to-nhibernate

开发者 https://www.devze.com 2023-02-18 12:29 出处:网络
Supposing I have the following hql: select cast(coalesce(sum(c.Valoare), 0) as decimal) from Comision as c

Supposing I have the following hql:

select cast(coalesce(sum(c.Valoare), 0) as decimal)
      from Comision as c
      where c.User = :user

Is there any way of writing this in Linq-T开发者_如何学Co-Nhibernate?


Can you use the C# null coalescing operator?

(from c in Comision
where c.User = user
select c.Valoare ?? 0).Sum()
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号