Example #1
0
        /// <summary>
        /// Re-Register an object in the locked cache
        /// </summary>
        /// <param name="pc">The Object</param>
        /// <param name="row">The data row, which holds the original state of the object</param>
        /// <param name="relations">A list of all relations of the object.</param>
        public void RegisterLockedObject(IPersistenceCapable pc, DataRow row, List <KeyValuePair <Relation, object> > relations)
        {
            if (pc.NDOObjectId == null)
            {
                throw new InternalException(60, "Cache.RegisterLockedObject: ObjectId of an object of type " + pc.GetType().FullName + " is null.");
            }

            if (!pc.NDOObjectId.IsValid())
            {
                throw new ArgumentException("Cannot register object with invalid key: " + pc);
            }

            if (lockedObjects.ContainsKey(pc.NDOObjectId))
            {
                throw new ArgumentException("Object already cached: " + pc.NDOObjectId, "pc");
            }
            Cache.Entry e = new Entry(pc, row, relations);
            lockedObjects.Add(pc.NDOObjectId, e);
        }
Example #2
0
        /// <summary>
        /// Remove an object from the cache
        /// </summary>
        /// <param name="pc">The object to remove</param>
        public void Deregister(IPersistenceCapable pc)
        {
            if (pc.NDOObjectId == null)
            {
                throw new InternalException(60, "Cache.Deregister: ObjectId of an object of type " + pc.GetType().FullName + " is null.");
            }

            objects.Remove(pc.NDOObjectId);
            lockedObjects.Remove(pc.NDOObjectId);
        }
Example #3
0
 internal Class GetClass(IPersistenceCapable pc)
 {
     return(GetClass(pc.GetType()));
 }