Unable to cast object of type 'NHibernate.Hql.Ast.HqlCast' to type 'NHibernate.Hql.Ast.HqlBooleanExpression
问题 I'm using the following c# code: public IList<T> GetAllByExpression(Expression<Func<T, bool>> expression, int startIndex, int count, Func<T, DateTime> dateTimeSelector) { using (ISession session = NHibernateHelper.GetSession()) { return session.Query<T>() .Where(expression) .OrderBy(dateTimeSelector) .Skip(startIndex - 1) .Take(count) .ToList(); } } update: even the follwoing code throws the same exception: public IList<T> GetAllByExpression(Expression<Func<T, bool>> expression, int