コード例 #1
0
		/// <summary> 
		/// Iterate just the elements of the collection that are already there. Don't load
		/// any new elements from the database.
		/// </summary>
		public static IEnumerable GetLoadedElementsIterator(ISessionImplementor session, CollectionType collectionType, object collection)
		{
			if (CollectionIsInitialized(collection))
			{
				// handles arrays and newly instantiated collections
				return collectionType.GetElementsIterator(collection, session);
			}
			else
			{
				// does not handle arrays (that's ok, cos they can't be lazy)
				// or newly instantiated collections, so we can do the cast
				return ((IPersistentCollection)collection).QueuedAdditionIterator;
			}
		}
コード例 #2
0
		/// <summary> 
		/// Given a collection, get an iterator of all its children, loading them
		/// from the database if necessary. 
		/// </summary>
		/// <param name="session">The session within which the cascade is occurring. </param>
		/// <param name="collectionType">The mapping type of the collection. </param>
		/// <param name="collection">The collection instance. </param>
		/// <returns> The children iterator. </returns>
		private static IEnumerable GetAllElementsIterator(IEventSource session, CollectionType collectionType, object collection)
		{
			return collectionType.GetElementsIterator(collection, session);
		}