From: NHibernate J. <mik...@us...> - 2006-11-15 13:29:25
|
[ http://jira.nhibernate.org/browse/NH-780?page=all ] Sergey Koshcheyev closed NH-780: -------------------------------- Resolution: Fixed > Obsolete code in the tips 'n tricks > ----------------------------------- > > Key: NH-780 > URL: http://jira.nhibernate.org/browse/NH-780 > Project: NHibernate > Type: Improvement > Components: Documentation > Versions: 1.2.0.Beta1 > Reporter: Guy Mahieu > Priority: Trivial > Fix For: 1.2.0.CR1 > > From the docs: > <blockquote/> > 11.13. Tips & Tricks > You can count the number of query results without actually returning them: > <code> > IEnumerator countEn = session.Enumerable("select count(*) from ....").GetEnumerator(); > countEn.MoveNext(); > int count = (int) countEn.Current; > </code> > </blockquote> > Other than looking like a workaround, this uses obsolete code (session.Enumerable); it might be better to change it to: > <code> > int count = (int) session.CreateQuery("select count(*) from ...").UniqueResult(); > </code> -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |