System.Data.XmlSchemaDataImporter.ReserveSelfIdentity C# (CSharp) Метод

ReserveSelfIdentity() приватный Метод

private ReserveSelfIdentity ( XmlSchemaIdentityConstraint ic ) : void
ic System.Xml.Schema.XmlSchemaIdentityConstraint
Результат void
		private void ReserveSelfIdentity (XmlSchemaIdentityConstraint ic)
		{
			string tableName = GetSelectorTarget (ic.Selector.XPath);

			string [] cols = new string [ic.Fields.Count];
			bool [] isAttrSpec = new bool [cols.Length];

			int i = 0;
			foreach (XmlSchemaXPath Field in ic.Fields) {
				string colName = Field.XPath;
				bool isAttr = colName.Length > 0 && colName [0] == '@';
				int index = colName.LastIndexOf (':');
				if (index > 0)
					colName = colName.Substring (index + 1);
				else if (isAttr)
					colName = colName.Substring (1);

				colName = XmlHelper.Decode (colName);
				cols [i] = colName;
				isAttrSpec [i] = isAttr;
				i++;
			}
			
			bool isPK = false;
			// find if there is an attribute with the constraint name
			// if not use the XmlSchemaConstraint's name.
			string constraintName = ic.Name;
			if (ic.UnhandledAttributes != null) {
				foreach (XmlAttribute attr in ic.UnhandledAttributes) {
					if (attr.NamespaceURI != XmlConstants.MsdataNamespace)
						continue;
					switch (attr.LocalName) {
					case XmlConstants.ConstraintName:
						constraintName = attr.Value;
						break;
					case XmlConstants.PrimaryKey:
						isPK = bool.Parse(attr.Value);
						break;
					}
				}
			}
			reservedConstraints.Add (ic,
				new ConstraintStructure (tableName, cols,
					isAttrSpec, constraintName, isPK, null, false, false));
		}