Summary description for XmlSchemaKeyref.
Inheritance: XmlSchemaIdentityConstraint
 void Write50_XmlSchemaKeyref(XmlSchemaKeyref o) {
     if ((object)o == null) return;
     System.Type t = o.GetType();
     WriteStartElement("keyref");
     
     WriteAttribute(@"id", @"", ((System.String)o.@Id));
     WriteAttribute(@"name", @"", ((System.String)o.@Name));
     WriteAttributes((XmlAttribute[])o.@UnhandledAttributes, o);
     // 
     WriteAttribute(@"refer", @"", o.@Refer);
     Write5_XmlSchemaAnnotation((XmlSchemaAnnotation)o.@Annotation);
     Write49_XmlSchemaXPath(@"selector", @"", (XmlSchemaXPath)o.@Selector); {
     XmlSchemaObjectCollection a = (XmlSchemaObjectCollection)o.@Fields;
     if (a != null) {
         for (int ia = 0; ia < a.Count; ia++) {
             Write49_XmlSchemaXPath(@"field", @"", (XmlSchemaXPath)a[ia]);
         }
     }
 }
     WriteEndElement();
 }
        internal static XmlSchemaKeyref Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaKeyref xmlSchemaKeyref = new XmlSchemaKeyref();

            reader.MoveToElement();
            if (reader.NamespaceURI != "http://www.w3.org/2001/XMLSchema" || reader.LocalName != "keyref")
            {
                XmlSchemaObject.error(h, "Should not happen :1: XmlSchemaKeyref.Read, name=" + reader.Name, null);
                reader.Skip();
                return(null);
            }
            xmlSchemaKeyref.LineNumber   = reader.LineNumber;
            xmlSchemaKeyref.LinePosition = reader.LinePosition;
            xmlSchemaKeyref.SourceUri    = reader.BaseURI;
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    xmlSchemaKeyref.Id = reader.Value;
                }
                else if (reader.Name == "name")
                {
                    xmlSchemaKeyref.Name = reader.Value;
                }
                else if (reader.Name == "refer")
                {
                    Exception ex;
                    xmlSchemaKeyref.refer = XmlSchemaUtil.ReadQNameAttribute(reader, out ex);
                    if (ex != null)
                    {
                        XmlSchemaObject.error(h, reader.Value + " is not a valid value for refer attribute", ex);
                    }
                }
                else if ((reader.NamespaceURI == string.Empty && reader.Name != "xmlns") || reader.NamespaceURI == "http://www.w3.org/2001/XMLSchema")
                {
                    XmlSchemaObject.error(h, reader.Name + " is not a valid attribute for keyref", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, xmlSchemaKeyref);
                }
            }
            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(xmlSchemaKeyref);
            }
            int num = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != "keyref")
                    {
                        XmlSchemaObject.error(h, "Should not happen :2: XmlSchemaKeyref.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (num <= 1 && reader.LocalName == "annotation")
                {
                    num = 2;
                    XmlSchemaAnnotation xmlSchemaAnnotation = XmlSchemaAnnotation.Read(reader, h);
                    if (xmlSchemaAnnotation != null)
                    {
                        xmlSchemaKeyref.Annotation = xmlSchemaAnnotation;
                    }
                }
                else if (num <= 2 && reader.LocalName == "selector")
                {
                    num = 3;
                    XmlSchemaXPath xmlSchemaXPath = XmlSchemaXPath.Read(reader, h, "selector");
                    if (xmlSchemaXPath != null)
                    {
                        xmlSchemaKeyref.Selector = xmlSchemaXPath;
                    }
                }
                else if (num <= 3 && reader.LocalName == "field")
                {
                    num = 3;
                    if (xmlSchemaKeyref.Selector == null)
                    {
                        XmlSchemaObject.error(h, "selector must be defined before field declarations", null);
                    }
                    XmlSchemaXPath xmlSchemaXPath2 = XmlSchemaXPath.Read(reader, h, "field");
                    if (xmlSchemaXPath2 != null)
                    {
                        xmlSchemaKeyref.Fields.Add(xmlSchemaXPath2);
                    }
                }
                else
                {
                    reader.RaiseInvalidElementError();
                }
            }
            return(xmlSchemaKeyref);
        }
		private void ProcessReferenceKey (XmlSchemaElement element, XmlSchemaKeyref keyref)
		{
			// Basic concept came from XmlSchemaMapper.cs

			string tableName = GetSelectorTarget (keyref.Selector.XPath);

			DataColumn [] cols;
			DataTable dt = dataset.Tables [tableName];
			if (dt == null)
				throw new DataException (String.Format ("Invalid XPath selection inside selector. Cannot find: {0}", tableName));

			cols = new DataColumn [keyref.Fields.Count];
			int i = 0;
			foreach (XmlSchemaXPath Field in keyref.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 = XmlConvert.DecodeName (colName);
				DataColumn col = dt.Columns [colName];
				if (isAttr && col.ColumnMapping != MappingType.Attribute)
					throw new DataException ("The XPath specified attribute field, but mapping type is not attribute.");
				if (!isAttr && col.ColumnMapping != MappingType.Element)
					throw new DataException ("The XPath specified simple element field, but mapping type is not simple element.");
				cols [i] = col;
				i++;
			}
			string name = keyref.Refer.Name;
			// get the unique constraint for the releation
			UniqueConstraint uniq = FindConstraint (name, element);
			// generate the FK.
			ForeignKeyConstraint fkc = new ForeignKeyConstraint(keyref.Name, uniq.Columns, cols);
			dt.Constraints.Add (fkc);
			// generate the relation.
			DataRelation rel = new DataRelation (keyref.Name, uniq.Columns, cols, false);
			if (keyref.UnhandledAttributes != null) {
				foreach (XmlAttribute attr in keyref.UnhandledAttributes)
					if (attr.LocalName == "IsNested" && attr.Value == "true" && attr.NamespaceURI == XmlConstants.MsdataNamespace)
						rel.Nested = true;
			}
			rel.SetParentKeyConstraint (uniq);
			rel.SetChildKeyConstraint (fkc);

			dataset.Relations.Add (rel);
		}
 protected override void Visit(XmlSchemaKeyref keyref)
 {
     _writer.WriteConstraintRow(_context, ArtItem.KeyRef, "Key Reference", keyref);
 }
		private void ReserveRelationIdentity (XmlSchemaElement element, XmlSchemaKeyref keyref)
		{
			// Basic concept came from XmlSchemaMapper.cs

			string tableName = GetSelectorTarget (keyref.Selector.XPath);

			string [] cols = new string [keyref.Fields.Count];
			bool [] isAttrSpec = new bool [cols.Length];
			int i = 0;
			foreach (XmlSchemaXPath Field in keyref.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++;
			}
			string constraintName = keyref.Name;
			bool isNested = false;
			bool isConstraintOnly = false;
			if (keyref.UnhandledAttributes != null) {
				foreach (XmlAttribute attr in keyref.UnhandledAttributes) {
					if (attr.NamespaceURI != XmlConstants.MsdataNamespace)
						continue;
					switch (attr.LocalName) {
					case XmlConstants.ConstraintName:
						constraintName = attr.Value;
						break;
					case XmlConstants.IsNested:
						if (attr.Value == "true")
							isNested = true;
						break;
					case XmlConstants.ConstraintOnly:
						if (attr.Value == "true")
							isConstraintOnly = true;
						break;
					}
				}
			}

			reservedConstraints.Add (keyref, new ConstraintStructure (
				tableName, cols, isAttrSpec, constraintName,
				false, keyref.Refer.Name, isNested, isConstraintOnly));
		}
		public override void Check (ConformanceCheckContext ctx, XmlSchemaKeyref value)
		{
			CheckSchemaQName (ctx, value, value.Refer);
		}
        internal void HandleKeyref(XmlSchemaKeyref keyref) {
            string refer = XmlConvert.DecodeName(keyref.Refer.Name); // check here!!!
            string name = XmlConvert.DecodeName(keyref.Name);
            name = GetStringAttribute( keyref, "ConstraintName", /*default:*/ name);
            
            // we do not process key defined outside the current node
            
            String tableName = GetTableName(keyref);

            string tableNs = GetMsdataAttribute(keyref,Keywords.MSD_TABLENS);
            
            DataTable table =  _ds.Tables.GetTableSmart(tableName,tableNs);
            
            if (table == null)
                return;

            if (refer == null || refer.Length == 0)
                throw ExceptionBuilder.MissingRefer(name);
            
            ConstraintTable key = (ConstraintTable) ConstraintNodes[refer];

            if (key == null) {
                throw ExceptionBuilder.InvalidKey(name);
            }

            DataColumn[] pKey = BuildKey(key.constraint, key.table);
            DataColumn[] fKey = BuildKey(keyref, table);

            ForeignKeyConstraint fkc = null;

            if (GetBooleanAttribute(keyref, Keywords.MSD_CONSTRAINTONLY,  /*default:*/ false)) {
                int iExisting = fKey[0].Table.Constraints.InternalIndexOf(name);
                if (iExisting > -1) {
                    if (fKey[0].Table.Constraints[iExisting].ConstraintName != name)
                        iExisting = -1;
                }
       
                if (iExisting < 0) {
                    fkc = new ForeignKeyConstraint( name, pKey, fKey );
                    fKey[0].Table.Constraints.Add(fkc);
                }
            }
            else {
                string relName = XmlConvert.DecodeName(GetStringAttribute( keyref, Keywords.MSD_RELATIONNAME, keyref.Name));

                if (relName == null || relName.Length == 0)
                    relName = name;

                int iExisting = fKey[0].Table.DataSet.Relations.InternalIndexOf(relName);
                if (iExisting > -1) {
                    if (fKey[0].Table.DataSet.Relations[iExisting].RelationName != relName)
                        iExisting = -1;
                }
                DataRelation relation = null;
                if (iExisting < 0) {
                    relation = new DataRelation(relName, pKey, fKey);
                    SetExtProperties(relation, keyref.UnhandledAttributes);
                    pKey[0].Table.DataSet.Relations.Add(relation);

                    if (FromInference && relation.Nested) {
                        if (tableDictionary.ContainsKey(relation.ParentTable)) {
                            tableDictionary[relation.ParentTable].Add(relation.ChildTable);
                        }
                    }
                    
                    fkc = relation.ChildKeyConstraint;
                    fkc.ConstraintName = name;
                } 
                else {
                    relation = fKey[0].Table.DataSet.Relations[iExisting];
                }
                if (GetBooleanAttribute(keyref, Keywords.MSD_ISNESTED,  /*default:*/ false)) {
                    relation.Nested = true;
                }

            }

            string acceptRejectRule = GetMsdataAttribute(keyref, Keywords.MSD_ACCEPTREJECTRULE);
            string updateRule       = GetMsdataAttribute(keyref, Keywords.MSD_UPDATERULE);
            string deleteRule       = GetMsdataAttribute(keyref, Keywords.MSD_DELETERULE);

            if (fkc != null) {
                if (acceptRejectRule != null)
                    fkc.AcceptRejectRule = TranslateAcceptRejectRule(acceptRejectRule);

                if (updateRule != null)
                    fkc.UpdateRule = TranslateRule(updateRule);

                if (deleteRule != null)
                    fkc.DeleteRule = TranslateRule(deleteRule);

                SetExtProperties(fkc, keyref.UnhandledAttributes);
            }
        }
Exemple #8
0
		/*
		internal new void error(ValidationEventHandler handle, string message)
		{
			errorCount++;
			ValidationHandler.RaiseValidationError(handle, this, message);
		}
		*/
		//<key 
		//  id = ID 
		//  name = NCName 
		//  refer = QName 
		//  {any attributes with non-schema namespace . . .}>
		//  Content: (annotation?, (selector, field+))
		//</key>
		internal static XmlSchemaKeyref Read(XmlSchemaReader reader, ValidationEventHandler h)
		{
			XmlSchemaKeyref keyref = new XmlSchemaKeyref();
			reader.MoveToElement();

			if(reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
			{
				error(h,"Should not happen :1: XmlSchemaKeyref.Read, name="+reader.Name,null);
				reader.Skip();
				return null;
			}

			keyref.LineNumber = reader.LineNumber;
			keyref.LinePosition = reader.LinePosition;
			keyref.SourceUri = reader.BaseURI;

			while(reader.MoveToNextAttribute())
			{
				if(reader.Name == "id")
				{
					keyref.Id = reader.Value;
				}
				else if(reader.Name == "name")
				{
					keyref.Name = reader.Value;
				}
				else if(reader.Name == "refer")
				{
					Exception innerex;
					keyref.refer = XmlSchemaUtil.ReadQNameAttribute(reader,out innerex);
					if(innerex != null)
						error(h, reader.Value + " is not a valid value for refer attribute",innerex);
				}
				else if((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
				{
					error(h,reader.Name + " is not a valid attribute for keyref",null);
				}
				else
				{
					XmlSchemaUtil.ReadUnhandledAttribute(reader,keyref);
				}
			}
			
			reader.MoveToElement();
			if(reader.IsEmptyElement)
				return keyref;

			//  Content: annotation?, selector, field+
			int level = 1;
			while(reader.ReadNextElement())
			{
				if(reader.NodeType == XmlNodeType.EndElement)
				{
					if(reader.LocalName != xmlname)
						error(h,"Should not happen :2: XmlSchemaKeyref.Read, name="+reader.Name,null);
					break;
				}
				if(level <= 1 && reader.LocalName == "annotation")
				{
					level = 2; //Only one annotation
					XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader,h);
					if(annotation != null)
						keyref.Annotation = annotation;
					continue;
				}
				if(level <= 2 && reader.LocalName == "selector")
				{
					level = 3;
					XmlSchemaXPath selector = XmlSchemaXPath.Read(reader,h,"selector");
					if(selector != null)
						keyref.Selector = selector;
					continue;
				}
				if(level <= 3 && reader.LocalName == "field")
				{
					level = 3;
					if(keyref.Selector == null)
						error(h,"selector must be defined before field declarations",null);
					XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");
					if(field != null)
						keyref.Fields.Add(field);
					continue;
				}
				reader.RaiseInvalidElementError();
			}
			return keyref;
		}
Exemple #9
0
		public virtual void Check (ConformanceCheckContext ctx, XmlSchemaKeyref value) {}
 private void Write50_XmlSchemaKeyref(XmlSchemaKeyref o)
 {
     if (o != null)
     {
         o.GetType();
         this.WriteStartElement("keyref");
         this.WriteAttribute("id", "", o.Id);
         this.WriteAttribute("name", "", o.Name);
         this.WriteAttributes(o.UnhandledAttributes, o);
         this.WriteAttribute("refer", "", o.Refer);
         this.Write5_XmlSchemaAnnotation(o.Annotation);
         this.Write49_XmlSchemaXPath("selector", "", o.Selector);
         XmlSchemaObjectCollection fields = o.Fields;
         if (fields != null)
         {
             for (int i = 0; i < fields.Count; i++)
             {
                 this.Write49_XmlSchemaXPath("field", "", (XmlSchemaXPath) fields[i]);
             }
         }
         this.WriteEndElement();
     }
 }
Exemple #11
0
        /*
         * internal new void error(ValidationEventHandler handle, string message)
         * {
         *  errorCount++;
         *  ValidationHandler.RaiseValidationError(handle, this, message);
         * }
         */
        //<key
        //  id = ID
        //  name = NCName
        //  refer = QName
        //  {any attributes with non-schema namespace . . .}>
        //  Content: (annotation?, (selector, field+))
        //</key>
        internal static XmlSchemaKeyref Read(XmlSchemaReader reader, ValidationEventHandler h)
        {
            XmlSchemaKeyref keyref = new XmlSchemaKeyref();

            reader.MoveToElement();

            if (reader.NamespaceURI != XmlSchema.Namespace || reader.LocalName != xmlname)
            {
                error(h, "Should not happen :1: XmlSchemaKeyref.Read, name=" + reader.Name, null);
                reader.Skip();
                return(null);
            }

            keyref.LineNumber   = reader.LineNumber;
            keyref.LinePosition = reader.LinePosition;
            keyref.SourceUri    = reader.BaseURI;

            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "id")
                {
                    keyref.Id = reader.Value;
                }
                else if (reader.Name == "name")
                {
                    keyref.Name = reader.Value;
                }
                else if (reader.Name == "refer")
                {
                    Exception innerex;
                    keyref.refer = XmlSchemaUtil.ReadQNameAttribute(reader, out innerex);
                    if (innerex != null)
                    {
                        error(h, reader.Value + " is not a valid value for refer attribute", innerex);
                    }
                }
                else if ((reader.NamespaceURI == "" && reader.Name != "xmlns") || reader.NamespaceURI == XmlSchema.Namespace)
                {
                    error(h, reader.Name + " is not a valid attribute for keyref", null);
                }
                else
                {
                    XmlSchemaUtil.ReadUnhandledAttribute(reader, keyref);
                }
            }

            reader.MoveToElement();
            if (reader.IsEmptyElement)
            {
                return(keyref);
            }

            //  Content: annotation?, selector, field+
            int level = 1;

            while (reader.ReadNextElement())
            {
                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.LocalName != xmlname)
                    {
                        error(h, "Should not happen :2: XmlSchemaKeyref.Read, name=" + reader.Name, null);
                    }
                    break;
                }
                if (level <= 1 && reader.LocalName == "annotation")
                {
                    level = 2; //Only one annotation
                    XmlSchemaAnnotation annotation = XmlSchemaAnnotation.Read(reader, h);
                    if (annotation != null)
                    {
                        keyref.Annotation = annotation;
                    }
                    continue;
                }
                if (level <= 2 && reader.LocalName == "selector")
                {
                    level = 3;
                    XmlSchemaXPath selector = XmlSchemaXPath.Read(reader, h, "selector");
                    if (selector != null)
                    {
                        keyref.Selector = selector;
                    }
                    continue;
                }
                if (level <= 3 && reader.LocalName == "field")
                {
                    level = 3;
                    if (keyref.Selector == null)
                    {
                        error(h, "selector must be defined before field declarations", null);
                    }
                    XmlSchemaXPath field = XmlSchemaXPath.Read(reader, h, "field");
                    if (field != null)
                    {
                        keyref.Fields.Add(field);
                    }
                    continue;
                }
                reader.RaiseInvalidElementError();
            }
            return(keyref);
        }
 protected virtual void Visit(XmlSchemaKeyref keyref)
 {
     Traverse(keyref.Selector);
     Traverse(keyref.Fields);
 }
 private void Write51_XmlSchemaKeyref(string n, string ns, XmlSchemaKeyref o, bool isNullable, bool needType)
 {
     if (o == null)
     {
         if (isNullable)
         {
             base.WriteNullTagLiteral(n, ns);
         }
     }
     else
     {
         if (!needType && !(o.GetType() == typeof(XmlSchemaKeyref)))
         {
             throw base.CreateUnknownTypeException(o);
         }
         base.EscapeName = false;
         base.WriteStartElement(n, ns, o, false, o.Namespaces);
         if (needType)
         {
             base.WriteXsiType("XmlSchemaKeyref", "http://www.w3.org/2001/XMLSchema");
         }
         base.WriteAttribute("id", "", o.Id);
         XmlAttribute[] unhandledAttributes = o.UnhandledAttributes;
         if (unhandledAttributes != null)
         {
             for (int i = 0; i < unhandledAttributes.Length; i++)
             {
                 XmlAttribute node = unhandledAttributes[i];
                 base.WriteXmlAttribute(node, o);
             }
         }
         base.WriteAttribute("name", "", o.Name);
         base.WriteAttribute("refer", "", base.FromXmlQualifiedName(o.Refer));
         this.Write11_XmlSchemaAnnotation("annotation", "http://www.w3.org/2001/XMLSchema", o.Annotation, false, false);
         this.Write47_XmlSchemaXPath("selector", "http://www.w3.org/2001/XMLSchema", o.Selector, false, false);
         XmlSchemaObjectCollection fields = o.Fields;
         if (fields != null)
         {
             for (int j = 0; j < fields.Count; j++)
             {
                 this.Write47_XmlSchemaXPath("field", "http://www.w3.org/2001/XMLSchema", (XmlSchemaXPath) fields[j], false, false);
             }
         }
         base.WriteEndElement(o);
     }
 }
 internal void HandleKeyref(XmlSchemaKeyref keyref)
 {
     string str3 = XmlConvert.DecodeName(keyref.Refer.Name);
     string defVal = XmlConvert.DecodeName(keyref.Name);
     defVal = this.GetStringAttribute(keyref, "ConstraintName", defVal);
     string tableName = this.GetTableName(keyref);
     string msdataAttribute = GetMsdataAttribute(keyref, "TableNamespace");
     DataTable tableSmart = this._ds.Tables.GetTableSmart(tableName, msdataAttribute);
     if (tableSmart != null)
     {
         if ((str3 == null) || (str3.Length == 0))
         {
             throw ExceptionBuilder.MissingRefer(defVal);
         }
         ConstraintTable table = (ConstraintTable) this.ConstraintNodes[str3];
         if (table == null)
         {
             throw ExceptionBuilder.InvalidKey(defVal);
         }
         DataColumn[] parentColumns = this.BuildKey(table.constraint, table.table);
         DataColumn[] childColumns = this.BuildKey(keyref, tableSmart);
         ForeignKeyConstraint childKeyConstraint = null;
         if (this.GetBooleanAttribute(keyref, "ConstraintOnly", false))
         {
             int num2 = childColumns[0].Table.Constraints.InternalIndexOf(defVal);
             if ((num2 > -1) && (childColumns[0].Table.Constraints[num2].ConstraintName != defVal))
             {
                 num2 = -1;
             }
             if (num2 < 0)
             {
                 childKeyConstraint = new ForeignKeyConstraint(defVal, parentColumns, childColumns);
                 childColumns[0].Table.Constraints.Add(childKeyConstraint);
             }
         }
         else
         {
             string name = XmlConvert.DecodeName(this.GetStringAttribute(keyref, "RelationName", keyref.Name));
             if ((name == null) || (name.Length == 0))
             {
                 name = defVal;
             }
             int num = childColumns[0].Table.DataSet.Relations.InternalIndexOf(name);
             if ((num > -1) && (childColumns[0].Table.DataSet.Relations[num].RelationName != name))
             {
                 num = -1;
             }
             DataRelation instance = null;
             if (num < 0)
             {
                 instance = new DataRelation(name, parentColumns, childColumns);
                 SetExtProperties(instance, keyref.UnhandledAttributes);
                 parentColumns[0].Table.DataSet.Relations.Add(instance);
                 if ((this.FromInference && instance.Nested) && this.tableDictionary.ContainsKey(instance.ParentTable))
                 {
                     this.tableDictionary[instance.ParentTable].Add(instance.ChildTable);
                 }
                 childKeyConstraint = instance.ChildKeyConstraint;
                 childKeyConstraint.ConstraintName = defVal;
             }
             else
             {
                 instance = childColumns[0].Table.DataSet.Relations[num];
             }
             if (this.GetBooleanAttribute(keyref, "IsNested", false))
             {
                 instance.Nested = true;
             }
         }
         string strRule = GetMsdataAttribute(keyref, "AcceptRejectRule");
         string str5 = GetMsdataAttribute(keyref, "UpdateRule");
         string str4 = GetMsdataAttribute(keyref, "DeleteRule");
         if (childKeyConstraint != null)
         {
             if (strRule != null)
             {
                 childKeyConstraint.AcceptRejectRule = TranslateAcceptRejectRule(strRule);
             }
             if (str5 != null)
             {
                 childKeyConstraint.UpdateRule = TranslateRule(str5);
             }
             if (str4 != null)
             {
                 childKeyConstraint.DeleteRule = TranslateRule(str4);
             }
             SetExtProperties(childKeyConstraint, keyref.UnhandledAttributes);
         }
     }
 }