/// <summary> /// Add a node to the hierarchy. /// </summary> /// <param name="node"> /// The node to add to the hierarchy. /// </param> public void AddNode(ConfigurationNode node) { if (node == null) { throw new ArgumentNullException("node"); } if (nodesById.ContainsKey(node.Id)) { return; // we already own this one } SetUniqueComponentName(node); AddSite(node, node.Name); node.Hierarchy = this; string nodeTypeName = node.GetType().FullName; if (!nodesByType.ContainsKey(node.Id)) { nodesByType[node.Id] = new NodeTypeEntryArrayList(); } if (node.Parent != null && nodesByType.ContainsKey(node.Parent.Id)) { NodeTypeEntryArrayList childTypes = nodesByType[node.Parent.Id]; NodeTypeEntry entry = new NodeTypeEntry(node, nodeTypeName); if (!childTypes.Contains(entry)) { childTypes.Add(entry); AddBaseTypes(node, childTypes); } } nodesById[node.Id] = node; AddNodeByName(node); }
/// <summary> /// <para>Add a node to the hierarchy.</para> /// </summary> /// <param name="node"> /// <para>The node to add to the hierarchy.</para> /// </param> public void AddNode(ConfigurationNode node) { if (node == null) { throw new ArgumentNullException("node"); } node.Hierarchy = this; string nodeTypeName = node.GetType().FullName; if (!nodesByType.Contains(node.Id)) { nodesByType[node.Id] = new NodeTypeEntryArrayList(); } if (node.Parent != null) { NodeTypeEntryArrayList childTypes = (NodeTypeEntryArrayList)nodesByType[node.Parent.Id]; NodeTypeEntry entry = new NodeTypeEntry(node, nodeTypeName); if (!childTypes.Contains(entry)) { childTypes.Add(entry); AddBaseTypes(node, childTypes); } } nodesById[node.Id] = node; AddToContainer(node); SetSiteName(node.Name, node); // make sure to add after contanier so the name is set AddNodeByName(node); }