示例#1
0
        /// <summary>
        /// Initializes a new instance of <see cref="CollectionEntry"/>.
        /// </summary>
        /// <remarks>
        /// For newly wrapped collections, or dereferenced collection wrappers
        /// </remarks>
        public CollectionEntry(ICollectionPersister persister, IPersistentCollection collection)
        {
            // new collections that get found + wrapped
            // during flush shouldn't be ignored
            ignore = false;

            collection.ClearDirty();             //a newly wrapped collection is NOT dirty (or we get unnecessary version updates)

            snapshot = persister.IsMutable ? collection.GetSnapshot(persister) : null;
            collection.SetSnapshot(loadedKey, role, snapshot);
        }
        /// <summary>
        /// Updates the CollectionEntry to reflect that it is has been successfully flushed to the database.
        /// </summary>
        /// <param name="collection">The <see cref="IPersistentCollection"/> that was flushed.</param>
        /// <remarks>
        /// Called after a <em>successful</em> flush.
        /// </remarks>
        public void PostFlush(IPersistentCollection collection)
        {
            if (IsIgnore)
            {
                ignore = false;
            }
            else if (!IsProcessed)
            {
                // the CollectionEntry should be processed if we are in the PostFlush()
                throw new AssertionFailure("collection [" + collection.Role + "] was not processed by flush()");
            }

            collection.SetSnapshot(loadedKey, role, snapshot);
        }
 /// <summary>
 /// Updates the CollectionEntry to reflect that the <see cref="IPersistentCollection"/>
 /// has been initialized.
 /// </summary>
 /// <param name="collection">The initialized <see cref="AbstractPersistentCollection"/> that this Entry is for.</param>
 public void PostInitialize(IPersistentCollection collection)
 {
     snapshot = LoadedPersister.IsMutable ? collection.GetSnapshot(LoadedPersister) : null;
     collection.SetSnapshot(loadedKey, role, snapshot);
 }
示例#4
0
		/// <summary>
		/// Updates the CollectionEntry to reflect that it is has been successfully flushed to the database.
		/// </summary>
		/// <param name="collection">The <see cref="IPersistentCollection"/> that was flushed.</param>
		/// <remarks>
		/// Called after a <em>successful</em> flush.
		/// </remarks>
		public void PostFlush(IPersistentCollection collection)
		{
			if (IsIgnore)
			{
				ignore = false;
			}
			else if (!IsProcessed)
			{
				// the CollectionEntry should be processed if we are in the PostFlush()
				throw new AssertionFailure("collection [" + collection.Role + "] was not processed by flush()");
			}

			collection.SetSnapshot(loadedKey, role, snapshot);
		}
示例#5
0
		/// <summary>
		/// Updates the CollectionEntry to reflect that the <see cref="IPersistentCollection"/>
		/// has been initialized.
		/// </summary>
		/// <param name="collection">The initialized <see cref="AbstractPersistentCollection"/> that this Entry is for.</param>
		public void PostInitialize(IPersistentCollection collection)
		{
			snapshot = LoadedPersister.IsMutable ? collection.GetSnapshot(LoadedPersister) : null;
			collection.SetSnapshot(loadedKey, role, snapshot);
		}
示例#6
0
		/// <summary> For collections just loaded from the database</summary>
		public CollectionEntry(IPersistentCollection collection, ICollectionPersister loadedPersister, object loadedKey,
		                       bool ignore)
		{
			this.ignore = ignore;
			this.loadedKey = loadedKey;
			SetLoadedPersister(loadedPersister);
			collection.SetSnapshot(loadedKey, role, null);
			//postInitialize() will be called after initialization
		}
示例#7
0
		/// <summary>
		/// Initializes a new instance of <see cref="CollectionEntry"/>.
		/// </summary>
		/// <remarks> 
		/// For newly wrapped collections, or dereferenced collection wrappers
		/// </remarks>
		public CollectionEntry(ICollectionPersister persister, IPersistentCollection collection)
		{
			// new collections that get found + wrapped
			// during flush shouldn't be ignored
			ignore = false;

			collection.ClearDirty(); //a newly wrapped collection is NOT dirty (or we get unnecessary version updates)

			snapshot = persister.IsMutable ? collection.GetSnapshot(persister) : null;
			collection.SetSnapshot(loadedKey, role, snapshot);
		}