Beispiel #1
0
        void DeleteItemCore(DemoItem item)
        {
            ItemCache.Remove(item.Id);
                if (item.IsFolder)
                {
                     List<DemoItem> childItems = ItemCache.Values.
                          Where(cacheItem => !cacheItem.IsRoot && cacheItem.ParentItem.Id == item.Id).
                          ToList();

                     foreach (DemoItem childItem in childItems)
                          DeleteItemCore(childItem);
                }
        }
Beispiel #2
0
 public override void AddItem(Item item)
 {
     DemoItem demoItem = new DemoItem(this)
         {
              Name = item.Name,
              IsFolder = item.IsFolder,
              Owner = item.Owner,
              OwnerId = item.Owner == null ? (long?)null : item.Owner.Id,
              ParentItem = item.ParentItem,
              ParentItemId = item.ParentItem == null ? (long?)null : item.ParentItem.Id,
              Content = item.Content,
              ContentId = item.Content == null ? (long?)null : item.Content.Id,
              CreationTime = item.CreationTime,
              LastAccessTime = item.LastAccessTime,
              LastWriteTime = item.LastWriteTime
         };
         lock (this.itemCacheLocker)
         {
              MaxItemId++;
              demoItem.Id = MaxItemId;
              ItemCache.Add(demoItem.Id, demoItem);
         }
         item.Id = demoItem.Id;
 }