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

XmlLoad() public method

public XmlLoad ( XmlNode node ) : void
node XmlNode
return void
        public override void XmlLoad(XmlNode node)
        {
            try
            {
                var relationshipsNode = node.SelectSingleNode("relationships"); //deprecated, use "r"
                if (relationshipsNode == null) relationshipsNode = node.SelectSingleNode("r");
                if (relationshipsNode != null)
                    this.Relationships.XmlLoad(relationshipsNode);

                var columnsNode = node.SelectSingleNode("columns"); //deprecated, use "c"
                if (columnsNode == null) columnsNode = node.SelectSingleNode("c");
                if (columnsNode != null)
                    this.Columns.XmlLoad(columnsNode);

                var compositesNode = node.SelectSingleNode("composites");
                if (compositesNode != null)
                    this.CompositeList.XmlLoad(compositesNode);

                var componentsNode = node.SelectSingleNode("components");
                if (componentsNode != null)
                    this.ComponentList.XmlLoad(componentsNode);

                var customRetrieveRulesNode = node.SelectSingleNode("customretrieverules");
                if (customRetrieveRulesNode != null)
                    this.CustomRetrieveRules.XmlLoad(customRetrieveRulesNode);

                var tableIndexListNode = node.SelectSingleNode("til");
                if (tableIndexListNode != null)
                    _tableIndexList.XmlLoad(tableIndexListNode, this.Root);

                this.Generated = XmlHelper.GetAttributeValue(node, "generated", _def_generated);
                this.Immutable = XmlHelper.GetAttributeValue(node, "immutable", _def_immutable);
                this.IsTenant = XmlHelper.GetAttributeValue(node, "isTenant", _def_isTenant);
                this.EnforcePrimaryKey = XmlHelper.GetAttributeValue(node, "enforePrimaryKey", _def_enforePrimaryKey);
                this.AllowUnitTest = (UnitTestSettingsConstants)Enum.Parse(typeof(UnitTestSettingsConstants), XmlHelper.GetAttributeValue(node, "allowUnitTest", _def_allowUnitTest.ToString()), true);

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

                var staticDataNode = node.SelectSingleNode("staticData");
                if (staticDataNode != null)
                    this.StaticData.XmlLoad(staticDataNode);

                //var unitTestNode = node.SelectSingleNode("unitTestDependencies");
                //if (unitTestNode != null)
                //{
                //  foreach (XmlNode n in unitTestNode.ChildNodes)
                //  {
                //    _unitTestTableIdPreLoad.Add(int.Parse(n.InnerText));
                //  }
                //}

                this.AssociativeTable = XmlHelper.GetAttributeValue(node, "associativeTable", _associativeTable);
                this.HasHistory = XmlHelper.GetAttributeValue(node, "hasHistory", _hasHistory);
                this.CreateMetaData = XmlHelper.GetAttributeValue(node, "createMetaData", _def_createMetaData);
                this.FullIndexSearch = XmlHelper.GetAttributeValue(node, "fullIndexSearch", _def_fullIndexSearch);

                _key = XmlHelper.GetAttributeValue(node, "key", string.Empty);
                this.Name = XmlHelper.GetAttributeValue(node, "name", string.Empty);
                this.DBSchema = XmlHelper.GetAttributeValue(node, "dbschema", _def_dbSchema);
                this.CodeFacade = XmlHelper.GetAttributeValue(node, "codeFacade", _def_codeFacade);
                this.Description = XmlHelper.GetAttributeValue(node, "description", _def_description);
                this.AllowModifiedAudit = XmlHelper.GetAttributeValue(node, "modifiedAudit", _modifiedAudit);
                this.AllowCreateAudit = XmlHelper.GetAttributeValue(node, "createAudit", _def_createAudit);
                this.TypedTable = (TypedTableConstants)XmlHelper.GetAttributeValue(node, "typedTable", int.Parse(_isTypeTable.ToString("d")));
                //_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.AllowTimestamp = XmlHelper.GetAttributeValue(node, "timestamp", _allowTimestamp);
                this.AllowAuditTracking = XmlHelper.GetAttributeValue(node, "allowAuditTracking", _def_allowAuditTracking);
                this.IsAbstract = XmlHelper.GetAttributeValue(node, "isAbstract", _def_isAbstract);
                this.GeneratesDoubleDerived = XmlHelper.GetAttributeValue(node, "generatesDoubleDerived", _def_generatesDoubleDerived);
                _parentTableKey = XmlHelper.GetAttributeValue(node, "parentTableKey", string.Empty);

                var metadataNode = node.SelectSingleNode("metadata");
                if (metadataNode != null)
                    this.MetaData.XmlLoad(metadataNode);

                var securityNode = node.SelectSingleNode("security");
                if (securityNode != null)
                    this.Security.XmlLoad(securityNode);

                this.Dirty = false;
            }
            catch (Exception ex)
            {
                throw;
            }
        }