nHydrate.Generator.Models.Relation.XmlLoad C# (CSharp) Method

XmlLoad() public method

public XmlLoad ( XmlNode node ) : void
node System.Xml.XmlNode
return void
        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;
        }