Exemplo n.º 1
0
        public override XmlNode XmlAppend(XmlNode node)
        {
            node.AddAttribute("key", this.Key);
            node.AddAttribute("enforce", this.Enforce);
            node.AddAttribute("description", this.Description, _def_description);
            node.AddAttribute("deleteAction", this.DeleteAction.ToString());
            this.ColumnRelationships.ResetKey(Guid.Empty, true); //no need to save this key
            node.AppendChild(ColumnRelationships.XmlAppend(node.CreateElement("crl")));
            node.AddAttribute("id", this.Id);
            node.AddAttribute("roleName", this.RoleName, _def_roleName);
            node.AddAttribute("constraintName", this.ConstraintName, _def_constraintname);

            var childTableRefNode = node.CreateElement("ct");

            if (this.ChildTableRef != null)
            {
                this.ChildTableRef.XmlAppend(childTableRefNode);
            }
            node.AppendChild(childTableRefNode);

            var parentTableRefNode = node.CreateElement("pt");

            if (this.ParentTableRef != null)
            {
                this.ParentTableRef.XmlAppend(parentTableRefNode);
            }
            node.AppendChild(parentTableRefNode);

            return(node);
        }
Exemplo n.º 2
0
        public override void XmlLoad(XmlNode node)
        {
            _key         = XmlHelper.GetAttributeValue(node, "key", string.Empty);
            _enforce     = XmlHelper.GetAttributeValue(node, "enforce", _def_enforce);
            _description = XmlHelper.GetAttributeValue(node, "description", _def_description);

            var columnRelationshipsNode = node.SelectSingleNode("columnRelationships"); //deprecated, use "crl"

            if (columnRelationshipsNode == null)
            {
                columnRelationshipsNode = node.SelectSingleNode("crl");
            }
            ColumnRelationships.XmlLoad(columnRelationshipsNode);

            var childTableRefNode = node.SelectSingleNode("childTableRef"); //deprecated, use "ct"

            if (childTableRefNode == null)
            {
                childTableRefNode = node.SelectSingleNode("ct");
            }
            if (this.ChildTableRef == null)
            {
                _childTableRef = new Reference(this.Root);
            }
            this.ChildTableRef.XmlLoad(childTableRefNode);

            var parentTableRefNode = node.SelectSingleNode("parentTableRef"); //deprecated, use "pt"

            if (parentTableRefNode == null)
            {
                parentTableRefNode = node.SelectSingleNode("pt");
            }
            if (this.ParentTableRef == null)
            {
                _parentTableRef = new Reference(this.Root);
            }
            this.ParentTableRef.XmlLoad(parentTableRefNode);

            this.ResetId(XmlHelper.GetAttributeValue(node, "id", _id));

            var roleName = XmlHelper.GetAttributeValue(node, "roleName", _def_roleName);

            if (roleName == "fk")
            {
                roleName = string.Empty;                   //Error correct from earlier versions
            }
            this.RoleName = roleName;

            this.ConstraintName = XmlHelper.GetAttributeValue(node, "constraintName", _def_constraintname);
            //_createdDate = DateTime.ParseExact(XmlHelper.GetAttributeValue(node, "createdDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture)), "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);

            this.Dirty = false;
        }
Exemplo n.º 3
0
        public override void XmlLoad(XmlNode node)
        {
            this.Key     = XmlHelper.GetAttributeValue(node, "key", string.Empty);
            _enforce     = XmlHelper.GetAttributeValue(node, "enforce", _def_enforce);
            _description = XmlHelper.GetAttributeValue(node, "description", _def_description);

            _deleteAction = (DeleteActionConstants)Enum.Parse(typeof(DeleteActionConstants), XmlHelper.GetAttributeValue(node, "deleteAction", _def_deleteAction.ToString()));

            var columnRelationshipsNode = node.SelectSingleNode("columnRelationships"); //deprecated, use "crl"

            if (columnRelationshipsNode == null)
            {
                columnRelationshipsNode = node.SelectSingleNode("crl");
            }
            ColumnRelationships.XmlLoad(columnRelationshipsNode);

            var childTableRefNode = node.SelectSingleNode("childTableRef"); //deprecated, use "ct"

            if (childTableRefNode == null)
            {
                childTableRefNode = node.SelectSingleNode("ct");
            }
            if (this.ChildTableRef == null)
            {
                _childTableRef = new Reference(this.Root);
            }
            this.ChildTableRef.XmlLoad(childTableRefNode);

            var parentTableRefNode = node.SelectSingleNode("parentTableRef"); //deprecated, use "pt"

            if (parentTableRefNode == null)
            {
                parentTableRefNode = node.SelectSingleNode("pt");
            }
            if (this.ParentTableRef == null)
            {
                _parentTableRef = new Reference(this.Root);
            }
            this.ParentTableRef.XmlLoad(parentTableRefNode);

            this.ResetId(XmlHelper.GetAttributeValue(node, "id", this.Id));

            var roleName = XmlHelper.GetAttributeValue(node, "roleName", _def_roleName);

            if (roleName == "fk")
            {
                roleName = string.Empty;                   //Error correct from earlier versions
            }
            this.RoleName = roleName;

            this.ConstraintName = XmlHelper.GetAttributeValue(node, "constraintName", _def_constraintname);
        }
Exemplo n.º 4
0
        public override void XmlAppend(XmlNode node)
        {
            var oDoc = node.OwnerDocument;

            XmlHelper.AddAttribute(node, "key", this.Key);
            XmlHelper.AddAttribute(node, "enforce", this.Enforce);

            if (this.Description != _def_description)
            {
                XmlHelper.AddAttribute(node, "description", this.Description);
            }

            var columnRelationshipsNode = oDoc.CreateElement("crl");

            ColumnRelationships.XmlAppend(columnRelationshipsNode);
            node.AppendChild(columnRelationshipsNode);

            var childTableRefNode = oDoc.CreateElement("ct");

            if (this.ChildTableRef != null)
            {
                this.ChildTableRef.XmlAppend(childTableRefNode);
            }
            node.AppendChild(childTableRefNode);

            var parentTableRefNode = oDoc.CreateElement("pt");

            if (this.ParentTableRef != null)
            {
                this.ParentTableRef.XmlAppend(parentTableRefNode);
            }
            node.AppendChild(parentTableRefNode);

            XmlHelper.AddAttribute(node, "id", this.Id);
            if (this.RoleName != _def_roleName)
            {
                XmlHelper.AddAttribute(node, "roleName", this.RoleName);
            }
            if (this.ConstraintName != _def_constraintname)
            {
                XmlHelper.AddAttribute(node, "constraintName", this.ConstraintName);
            }
            //XmlHelper.AddAttribute(node, "createdDate", _createdDate.ToString("yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture));
        }
Exemplo n.º 5
0
        public override void XmlAppend(XmlNode node)
        {
            var oDoc = node.OwnerDocument;

            node.AddAttribute("key", this.Key);
            node.AddAttribute("enforce", this.Enforce);
            node.AddAttribute("description", this.Description, _def_description);
            node.AddAttribute("deleteAction", this.DeleteAction.ToString());

            var columnRelationshipsNode = oDoc.CreateElement("crl");

            ColumnRelationships.XmlAppend(columnRelationshipsNode);
            node.AppendChild(columnRelationshipsNode);

            var childTableRefNode = oDoc.CreateElement("ct");

            if (this.ChildTableRef != null)
            {
                this.ChildTableRef.XmlAppend(childTableRefNode);
            }
            node.AppendChild(childTableRefNode);

            var parentTableRefNode = oDoc.CreateElement("pt");

            if (this.ParentTableRef != null)
            {
                this.ParentTableRef.XmlAppend(parentTableRefNode);
            }
            node.AppendChild(parentTableRefNode);

            node.AddAttribute("id", this.Id);
            if (this.RoleName != _def_roleName)
            {
                node.AddAttribute("roleName", this.RoleName);
            }
            if (this.ConstraintName != _def_constraintname)
            {
                node.AddAttribute("constraintName", this.ConstraintName);
            }
        }