System.Data.XmlSchemaWriter.WriteChildRelations C# (CSharp) Method

WriteChildRelations() private method

private WriteChildRelations ( DataRelation rel ) : void
rel DataRelation
return void
		private void WriteChildRelations (DataRelation rel)
		{
			// If there is a parent/child relation and only one table,
			// it would just be a ref element.
			if (rel.ChildTable.Namespace != dataSetNamespace ||
			    tables.Length < 2) {
				w.WriteStartElement ("xs", "element", xmlnsxs);
				w.WriteStartAttribute ("ref", String.Empty);
				w.WriteQualifiedName (
					XmlHelper.Encode (rel.ChildTable.TableName),
					rel.ChildTable.Namespace);
				w.WriteEndAttribute ();
			} else {
				w.WriteStartElement ("xs", "element", xmlnsxs);
				w.WriteStartAttribute ("name", String.Empty);
				w.WriteQualifiedName (
					XmlHelper.Encode (rel.ChildTable.TableName),
					rel.ChildTable.Namespace);
				w.WriteEndAttribute ();
				w.WriteAttributeString ("minOccurs", "0");
				w.WriteAttributeString ("maxOccurs", "unbounded");

				globalTypeTables.Add (rel.ChildTable);
			}
			
			// Iff there is a genuine ChildTable and not just a ref, call WriteTableType
			if (tables.Length > 1)
				WriteTableType (rel.ChildTable);
			w.WriteEndElement ();
		}