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

XmlAppend() public method

public XmlAppend ( XmlNode node ) : void
node XmlNode
return void
        public override void XmlAppend(XmlNode node)
        {
            try
            {
                var oDoc = node.OwnerDocument;

                XmlHelper.AddAttribute(node, "key", this.Key);
                XmlHelper.AddAttribute(node, "name", this.Name);

                if (this.DBSchema != _def_dbSchema)
                    XmlHelper.AddAttribute(node, "dbschema", this.DBSchema);

                if (this.CodeFacade != _def_codeFacade)
                    XmlHelper.AddAttribute(node, "codeFacade", this.CodeFacade);

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

                if (this.Relationships.Count > 0)
                {
                    var relationshipsNode = oDoc.CreateElement("r");
                    this.Relationships.XmlAppend(relationshipsNode);
                    node.AppendChild(relationshipsNode);
                }

                var tableIndexListNode = oDoc.CreateElement("til");
                _tableIndexList.XmlAppend(tableIndexListNode);
                node.AppendChild(tableIndexListNode);

                var columnsNode = oDoc.CreateElement("c");
                this.Columns.XmlAppend(columnsNode);
                node.AppendChild(columnsNode);

                //XmlNode unitTestNode = oDoc.CreateElement("unitTestDependencies");
                //node.AppendChild(unitTestNode);
                //foreach (Table t in this.UnitTestDependencies)
                //{
                //  XmlHelper.AddElement((XmlElement)unitTestNode, "tableid", t.Id.ToString());
                //}

                if (this.CompositeList.Count > 0)
                {
                    var compositesNode = oDoc.CreateElement("composites");
                    this.CompositeList.XmlAppend(compositesNode);
                    node.AppendChild(compositesNode);
                }

                if (this.ComponentList.Count > 0)
                {
                    var componentsNode = oDoc.CreateElement("components");
                    this.ComponentList.XmlAppend(componentsNode);
                    node.AppendChild(componentsNode);
                }

                if (this.CustomRetrieveRules.Count > 0)
                {
                    var customRetrieveRulesNode = oDoc.CreateElement("customretrieverules");
                    this.CustomRetrieveRules.XmlAppend(customRetrieveRulesNode);
                    node.AppendChild(customRetrieveRulesNode);
                }

                if (this.Generated != _def_generated)
                    XmlHelper.AddAttribute(node, "generated", this.Generated);

                if (this.IsTenant != _def_isTenant)
                    XmlHelper.AddAttribute(node, "isTenant", this.IsTenant);

                if (this.Immutable != _def_immutable)
                    XmlHelper.AddAttribute(node, "immutable", this.Immutable);

                if (this.EnforcePrimaryKey != _def_enforePrimaryKey)
                    XmlHelper.AddAttribute(node, "enforePrimaryKey", this.EnforcePrimaryKey);

                if (this.AllowUnitTest != _def_allowUnitTest)
                    XmlHelper.AddAttribute(node, "allowUnitTest", (int)this.AllowUnitTest);

                if (this.AllowModifiedAudit != _def_modifiedAudit)
                    XmlHelper.AddAttribute(node, "modifiedAudit", this.AllowModifiedAudit);

                if (this.TypedTable != _def_isTypeTable)
                    XmlHelper.AddAttribute(node, "typedTable", this.TypedTable.ToString("d"));

                if (this.AllowCreateAudit != _def_createAudit)
                    XmlHelper.AddAttribute(node, "createAudit", this.AllowCreateAudit);

                if (this.AllowTimestamp != _def_timestamp)
                    XmlHelper.AddAttribute(node, "timestamp", this.AllowTimestamp);

                if (this.IsAbstract != _def_isAbstract)
                    XmlHelper.AddAttribute(node, "isAbstract", this.IsAbstract);

                if (this.GeneratesDoubleDerived != _def_generatesDoubleDerived)
                    XmlHelper.AddAttribute(node, "generatesDoubleDerived", this.GeneratesDoubleDerived);

                XmlHelper.AddAttribute(node, "id", this.Id);

                if (this.StaticData.Count > 0)
                {
                    var staticDataNode = oDoc.CreateElement("staticData");
                    this.StaticData.XmlAppend(staticDataNode);
                    node.AppendChild(staticDataNode);
                }

                if (this.AssociativeTable != _def_associativeTable)
                    XmlHelper.AddAttribute(node, "associativeTable", this.AssociativeTable);

                if (this.HasHistory != _def_hasHistory)
                    XmlHelper.AddAttribute(node, "hasHistory", this.HasHistory);

                if (this.CreateMetaData != _def_createMetaData)
                    XmlHelper.AddAttribute(node, "createMetaData", this.CreateMetaData);

                if (this.FullIndexSearch != _def_fullIndexSearch)
                    XmlHelper.AddAttribute(node, "fullIndexSearch", this.FullIndexSearch);

                //XmlHelper.AddAttribute(node, "createdDate", _createdDate.ToString("yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture));

                if (this.AllowAuditTracking != _def_allowAuditTracking)
                    XmlHelper.AddAttribute(node, "allowAuditTracking", this.AllowAuditTracking);

                if (this.ParentTable != null)
                {
                    XmlHelper.AddAttribute(node, "parentTableKey", this.ParentTableKey);
                }

                if (this.MetaData.Count > 0)
                {
                    var metadataNode = oDoc.CreateElement("metadata");
                    this.MetaData.XmlAppend(metadataNode);
                    node.AppendChild(metadataNode);
                }

                var securityNode = oDoc.CreateElement("security");
                this.Security.XmlAppend(securityNode);
                node.AppendChild(securityNode);

            }
            catch (Exception ex)
            {
                throw;
            }

        }