/// <summary> /// Finds the ComplexTypeSchema where the column was initially declared. /// </summary> /// <returns>The ComplexTypeSchema where the column was defined.</returns> private ComplexTypeSchema FindDeclaringType(XmlSchemaObject typeObject, XmlSchemaObject columnObject) { // If the column was declared in the base class, then it owns it. Note that the class is recursive and will continue // to search the hiararchy until the column is found. If it wasn't found anywhere in the base classes, then the // current level of the hierarchy will be searched to see if it owns the column. XmlSchemaComplexType baseTypeObject = FindBaseType(typeObject); if (baseTypeObject != null) { ComplexTypeSchema declaringType = FindDeclaringType(baseTypeObject, columnObject); if (declaringType != null) { return(declaringType); } } // If the column doesn't belong to one of the base classes, then see if it was declared at the current level of the // hierarchy. if (typeObject is XmlSchemaComplexType) { XmlSchemaComplexType xmlSchemaComplexType = typeObject as XmlSchemaComplexType; if (ContainsColumn(xmlSchemaComplexType, columnObject)) { return(new ComplexTypeSchema(this.dataModelSchema, xmlSchemaComplexType)); } } // At this point, the specified column hasn't been found at this level of the hiearchy. This will allow the recursion // to unwind and the next level up, if it exists, will be tested. return(null); }
public void Add(ComplexTypeSchema classSchema) { this.classList.Add(classSchema.QualifiedName, classSchema); }