Beispiel #1
0
 /// <summary> Called by the <tt>Count</tt> property</summary>
 protected virtual bool ReadSize()
 {
     if (!initialized)
     {
         if (cachedSize != -1 && !HasQueuedOperations)
         {
             return(true);
         }
         else
         {
             ThrowLazyInitializationExceptionIfNotConnected();
             CollectionEntry      entry     = session.PersistenceContext.GetCollectionEntry(this);
             ICollectionPersister persister = entry.LoadedPersister;
             if (persister.IsExtraLazy)
             {
                 if (HasQueuedOperations)
                 {
                     session.Flush();
                 }
                 cachedSize = persister.GetSize(entry.LoadedKey, session);
                 return(true);
             }
         }
     }
     Read();
     return(false);
 }