Nhibernate QueryOver:在where子句中计数

Nhibernate QueryOver:在where子句中计数,nhibernate,Nhibernate,有关如何将以下内容转换为QueryOver的任何提示: var widget = session.Query<Widget>() .Fetch(x => x.NotificationJobs) .Where(x => x.Status == Status.Active && !x.

有关如何将以下内容转换为QueryOver的任何提示:

 var widget = session.Query<Widget>()
                    .Fetch(x => x.NotificationJobs)
                    .Where(x =>
                        x.Status == Status.Active &&
                        !x.NotificationJobs.Any())
                    .OrderByDescending(x => x.DateCreated)
                    .Take(1)
                    .SingleOrDefault();
var widget=session.Query()
.Fetch(x=>x.NotificationJobs)
.其中(x=>
x、 状态==状态。活动&&
!x.NotificationJobs.Any())
.OrderByDescending(x=>x.DateCreated)
.采取(1)
.SingleOrDefault();
想要获取没有通知作业的小部件。

var widgetWithNoNotificationJob=session.QueryOver()
var widgetWithNoNotificationJob = session.QueryOver<Widget>()
    .Where( x => x.Status == Status.Active )
    .OrderBy( x => x.DateCreated ).Desc
    .Left.JoinQueryOver<NotificationJob>( x => x.NotificationJobs )
        .Where( x => x.NotificationJobId == null )
    .Take( 1 )
    .SingleOrDefault();
.Where(x=>x.Status==Status.Active) .OrderBy(x=>x.DateCreated).Desc .Left.JoinQueryOver(x=>x.NotificationJobs) .其中(x=>x.NotificationJobId==null) .采取(1) .SingleOrDefault();
这将生成在NotificationJob表上具有左外部联接的SQL,以及具有NotificationJob.NotificationJobId的WHERE子句为NULL

希望这将为你指明正确的方向