protected IInstanceNodesCollection AddChildren(IAddressSpaceCreator space, XmlQualifiedName parentNodeID, int parentAddressSpaceIndex, bool isInstanceDeclaration) { IInstanceNodesCollection _children = space.CreateNodesCollection(); foreach (IInstanceNode item in this.Children) { _children.Add(item, parentNodeID, parentAddressSpaceIndex, isInstanceDeclaration); } return(_children); }
/// <summary> /// Instances the declarations. /// </summary> /// <param name="childrenCollection">The children collection.</param> /// <param name="parent">The parent.</param> void ITypeDesign.InstanceDeclarations(IInstanceNodesCollection childrenCollection, IInstanceNodeContext parent) { m_InheritanceDepth++; try { if (m_InheritanceDepth > m_MaxInheritanceDepth) { parent.Assert(false, String.Format("The depth of instance declaration is greater than the maximum {0}", m_MaxInheritanceDepth)); return; } foreach (IInstanceNode _childItem in this.Children) { if (!_childItem.IsMandatory) { continue; } childrenCollection.Add(_childItem, parent, parent.NodeID); } foreach (Reference item in References) { parent.AddReference(item, this, parent.NodeID); } XmlQualifiedName myType = this.Wrapper.BaseType.ValueOrDefault; ITypeDesign type = SolutionTreeNode.SolutionRoot.FindType(myType); if (this.Wrapper.IsItRootType) { return; } if (type == null) { parent.Assert(false, "Broken inheritance chain of the base type for this node."); return; } type.InstanceDeclarations(childrenCollection, parent); } finally { m_InheritanceDepth--; } }