开发者

Anonymous count with nhibernate criteria?

开发者 https://www.devze.com 2023-01-21 17:25 出处:网络
Is it possible to create a anoynmous count with nhibernate? The below query throws the exception \"No column *\".

Is it possible to create a anoynmous count with nhibernate?

The below query throws the exception "No column *". I could of course add a column name, but I'd prefer not to, because if I do, I'll have to lookup column names for 95 tables...

NHibernate.Criterion.DetachedCriteria dcIsUniqueDomainname = NHibernate.Criterion开发者_运维百科.DetachedCriteria.For<nhDBapi.Tables.clsDomains>()
               .SetProjection(
                   NHibernate.Criterion.Projections.Count("*")
               )
               .Add(NHibernate.Criterion.Property.ForName("DomainID").Eq(strDomainID))
               .Add(NHibernate.Criterion.Property.ForName("DomainName").Eq(strDomainName)
           );


You are Looking for Projections.RowCount().

0

精彩评论

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