Exemplo n.º 1
0
        /// <summary>
        /// The page is pointing a Parent, this parent could be an Object or a string,
        /// so we need to return always the parent as string
        /// </summary>
        public string GetPageParentUniqueID(IVirtualPage page)
        {
            var parentAsIStateObject = page.Parent as IStateObject;

            if (parentAsIStateObject != null)
            {
                return(parentAsIStateObject.UniqueID);
            }
            else
            {
                return(page.Parent as string);
            }
        }
 public void RestorePage(IStateManager stateManager, IReferenceManager referenceManager, IVirtualPage page, HashSet <string> alreadyPromotedHashSet)
 {
     foreach (LazyObject item in page.StoredObjects)
     {
         if (item.TargetUniqueID != null)
         {
             stateManager.PromoteListItem(item.TargetUniqueID, item.Target as IStateObject, true, alreadyPromotedHashSet);
         }
     }
 }
 /// <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.
 }