Hi,

I need to serialise a data tree however the performance of this is
understandable poor as all children must be fetched prior to
serialisation.  I was looking for a better performing way of doing
this.

Currently before serialising a child collection I check wether the
collection is empty by:

if(NHibernate.NHibernateUtil.IsInitialized(Children)) { return
Children.Count() > 0; }
NHibernate.IQuery q = GetSession().CreateFilter(Children, "Select
count(*)");
return Convert.ToInt32(q.UniqueResult()) > 0;

This greatly improves performance over a straight call to
Children.Count() but I still think there must be a better way of doing
this.

If an Entity has 2+ children collections can I get their count in one
database call?

Any other suggestions?

Thanks

Guido Tapia
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to