Пример #1
0
 protected virtual void RemoveProvider(string providerName)
 {
     if (providerName == null)
     {
         throw new ArgumentNullException("providerName");
     }
     lock (_providerLock)
     {
         var providerFromName = GetProviderFromName(providerName);
         var node             = ChildProviderRootNodes[providerFromName];
         if (node == null)
         {
             throw new InvalidOperationException(string.Format("StaticSiteMapProviderEx_cannot_find_provider", providerFromName.Name, Name));
         }
         providerFromName.ParentProvider = null;
         ChildProviderRootNodes.Remove(providerFromName);
         _childProviders = null;
         base.RemoveNode(node);
     }
 }
Пример #2
0
        private SiteMapNode GetNodeFromProvider(string providerName, Action <SiteMapNode> rebaseAction)
        {
            var providerFromName = GetProviderFromName(providerName);
            var rootNode         = providerFromName.RootNode;

            if (rootNode == null)
            {
                throw new InvalidOperationException(string.Format("StaticSiteMapProviderEx_invalid_GetRootNodeCore", providerFromName.Name));
            }
            if (!ChildProviderRootNodes.ContainsKey(providerFromName))
            {
                ChildProviderRootNodes.Add(providerFromName, rootNode);
                _childProviders = null;
                providerFromName.ParentProvider = this;
                if (rebaseAction != null)
                {
                    rebaseAction(rootNode);
                }
            }
            return(rootNode);
        }