public bool Remove(TKey key)
        {
            var referencedObject = (IStateObject)this[key];
            var stateobject      = referencedObject as IStateObject;

            if (stateobject != null)
            {
                _referencesManager.UnSubscribe(_parent, stateobject.UniqueID);
            }
            return(internalDictCase2.Remove(key));
        }
        public bool Remove(TKey key)
        {
            CollectionStateObjectReference valueRef;

            if (internalDictCase6.TryGetValue(key, out valueRef))
            {
                referencesManager.UnSubscribe(valueObject: _parent, UniqueID: valueRef.Target.UniqueID);
                return(internalDictCase6.Remove(key));
            }
            return(false);
        }
Exemple #3
0
        protected void UnSubscribeToReferenceManager(IReferenceManager _referenceManager, Page page, object item)
        {
            var stateobject = item as IStateObject;

            if (stateobject != null)
            {
                //Subscribe the item into the page's reference table
                _referenceManager.UnSubscribe(page, stateobject.UniqueID);
            }
        }
 public void Clear()
 {
     foreach (var pageId in InitialPositionOfEachPage.Keys)
     {
         Page p = _pageManager.LoadPage(pageId);
         foreach (var item in p.GetStoredObjectsSafe())
         {
             var wakeupelement = ((LazyObject)item).Target as IStateObject;
             if (wakeupelement != null)
             {
                 _referenceManager.UnSubscribe(p, wakeupelement.UniqueID);
             }
         }
         p.ClearSafe();
     }
     PageUniqueIdOfTheIndexes.Clear();
     InitialPositionOfEachPage.Clear();
     _stateManager.MarkAsDirty(this, "Count");
 }
 /// <summary>
 /// Removes the page from the session and cleans up its item's references.
 /// </summary>
 public void CleanUpPage(IStateManager stateManager, IReferenceManager referenceManager, IVirtualPage page, string rootUniqueID = "", bool isDispose = false)
 {
     if (!isDispose)
     {
         foreach (var item in page.StoredObjects)
         {
             var lazyItem = item as LazyObject;
             lazyItem.StateManager = stateManager;
             if (lazyItem.TargetUniqueID != null)
             {
                 //Removes the reference between the list items and the Page.
                 referenceManager.UnSubscribe(page, lazyItem.TargetUniqueID, true, rootUniqueID);
             }
         }
         stateManager.DettachObject(page);
     }
     else
     {
         bool justPromoted;
         stateManager.RemoveObjectReference(page.UniqueID, out justPromoted, removeEntryFromCache: false);
     }
     //Removes the page instance from the storage.
 }