문제

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().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top