NHibernate:行/结果计数:Projection.RowCount()与Projection.Count()的比较

NHibernate:行/结果计数:Projection.RowCount()与Projection.Count()的比较,nhibernate,count,projection,rowcount,Nhibernate,Count,Projection,Rowcount,NHibernates和NHibernates的确切区别是什么 Projection.RowCount() 及 当我们查找行数/结果数时?Projection.Count希望您传递一个需要计数的属性,即 Projection.Count("propertyName") 在SQL中,哪个转换为以下内容 select Count(this.whateverNhibernateConvention) from table as this 至于Projection.RowCount,您不需要传递

NHibernates和NHibernates的确切区别是什么

Projection.RowCount() 


当我们查找行数/结果数时?

Projection.Count希望您传递一个需要计数的属性,即

Projection.Count("propertyName")
在SQL中,哪个转换为以下内容

select Count(this.whateverNhibernateConvention) from table as this
至于Projection.RowCount,您不需要传递任何转换为

select Count(1) from table as this

我想我希望在第二个表达式中出现上述情况,这不应该是
select Count(*)
?我不知道在什么
select count(1)
结果中,但我认为(至少在Transact-SQL中)应该是“count(*)”,以匹配您的第二个解释?不,select count(1)完全可以。。COUNT函数不需要像使用COUNT(*)语法时那样从表中检索所有字段。它只会为满足条件的每条记录检索数值1。希望这是有意义的查询成本是相同的,无论您使用什么。。Count(1)是Count(*)的伪装我使用Projections.Count(Projections.Id())而不是Projection.RowCount()获得了更好的性能
select Count(1) from table as this