Beispiel #1
0
 internal void Dispose()
 {
     storage.Dispose();
     childrenTracker.Dispose();
     storage         = null;
     childrenTracker = null;
 }
Beispiel #2
0
 public void Dispose()
 {
     this._serializer              = null;
     this._stateManager            = null;
     this._surrogateManager        = null;
     this._surrogatesToBePersisted = null;
     if (storageCache != null)
     {
         this.storageCache.Dispose();
         this.storageCache = null;
     }
 }
Beispiel #3
0
        public override List <string> GetChildren(string uniqueId)
        {
            // If the storageCache is null, then loop through all the items and create the cache.
            // The lifecycle of the cache is expected to be of a single request, so there's no need to track changes made in the storage.
            List <string> result = new List <string>();

            if (storageCache == null)
            {
                storageCache = new ChildrenTracker(_stateManager);
                var uniqueIdToCheck = UniqueIDGenerator.UniqueIdSeparator + uniqueId;
                foreach (string id in GetAllItems())
                {
                    // No need to remove the WM_PREFIX, as the method GetAllItems already does
                    // var trimmedId = id.StartsWith(WM_PREFIX) ? id.Substring(3) : id;
                    storageCache.Add(id);
                }
            }
            return(storageCache.GetAllDependentKeys(uniqueId));
        }
Beispiel #4
0
 public HierarchicalStorage(IStateManager stateManager)
 {
     childrenTracker = new ChildrenTracker(stateManager);
     storage         = new PlainStorage <T>(stateManager);
 }