带 AND 条件的 QueryOver HAVING 子句

QueryOver HAVING clause with AND condition

我正在尝试创建一个包含 AND 的 HAVING 子句,它创建了一个 WHERE 子句。

我测试了一下,似乎只有当我有 AND 或 OR 时才会出现问题。

这里可以看到简化版的代码(两部分AND限制是一样的,只是为了简化问题)。

eventQuery = eventQuery.Where(
                    Restrictions.And(
                        Restrictions.Le(
                            Projections.Conditional(
                                Restrictions.LeProperty( Projections.Property( () => aEvent.StartDate.End ), Projections.Max( () => aMeeting.Duration.Start ) ),
                                Projections.Max( () => aMeeting.Duration.Start ),
                                Projections.Property( () => aEvent.StartDate.End ) ),

                            DateTime.Now ),

                    Restrictions.Le(
                        Projections.Conditional(
                            Restrictions.LeProperty( Projections.Property( () => aEvent.StartDate.End ), Projections.Max( () => aMeeting.Duration.Start ) ),
                            Projections.Max( () => aMeeting.Duration.Start ),
                            Projections.Property( () => aEvent.StartDate.End ) ),

                        DateTime.Now ) )

                    );

你们有什么想法吗?

这个问题似乎没有解决方案,因此我们决定改为创建此查询的视图,以便我们可以将其映射到模型,并针对选定的计算字段编写带有 Where 子句的 QueryOver。