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()
.
精彩评论