コード例 #1
0
        public override IEnumerable <ItemInfo> GetItems(ItemContainerInfo container)
        {
            // I wouldn't so aggressively store the child items but calling Get-ChildItem cmdlet
            // checks multiple times the existence of a "*" child. Because this triggers the
            // children retrieval I'd better cache them. The cache stores resolved SharePoint
            // objects by their path. I could adapt the cache to accommodate the collections of
            // children too but it was easier to utilize an internal property in the parent web
            // instance, which even performs better.
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }
            var list   = container as ListInfo;
            var folder = container as FolderInfo;
            var items  = list != null ? list.ChildItems : folder.ChildItems;

            if (items == null || !Cache.Check())
            {
                items = GetItemsDirectly(container);
                if (list != null)
                {
                    list.ChildItems = items;
                }
                else
                {
                    folder.ChildItems = items;
                }
            }
            return(items);
        }
コード例 #2
0
 protected override IEnumerable <ListInfo> GetAllLists(WebInfo web)
 {
     // The cache stores resolved SharePoint objects by their path. I could adapt the
     // cache to accommodate the collections of children too but it was easier to utilize
     // an internal property in the parent web instance, which even performs better.
     if (web.Lists == null || !Cache.Check())
     {
         web.Lists = GetAllListsDirectly(web);
     }
     return(web.Lists);
 }
コード例 #3
0
        // Implementation of the rest of the NavigatingConnector interface.

        public override IEnumerable <WebInfo> GetWebs(WebInfo web)
        {
            if (web == null)
            {
                throw new ArgumentNullException("web");
            }
            // I wouldn't so aggressively store the child webs but calling Get-ChildItem cmdlet
            // checks multiple times the existence of a "*" child. Because this triggers the
            // children retrieval I'd better cache them. The cache stores resolved SharePoint
            // objects by their path. I could adapt the cache to accommodate the collections of
            // children too but it was easier to utilize an internal property in the parent web
            // instance, which even performs better.
            if (web.Webs == null || !Cache.Check())
            {
                web.Webs = GetWebsDirectly(web);
            }
            return(web.Webs);
        }