Example #1
0
        public override void XmlAppend(XmlNode node)
        {
            try
            {
                var oDoc = node.OwnerDocument;

                node.AddAttribute("key", this.Key);
                node.AddAttribute("primaryKey", this.PrimaryKey, _def_primaryKey);
                node.AddAttribute("computedColumn", this.ComputedColumn, _def_computedColumn);
                node.AddAttribute("isReadOnly", this.IsReadOnly, _def_isReadOnly);
                node.AddAttribute("formula", this.Formula, _def_formula);
                node.AddAttribute("identity", (int)this.Identity, (int)_def_identity);
                node.AddAttribute("name", this.Name);
                node.AddAttribute("codeFacade", this.CodeFacade, _def_codefacade);
                node.AddAttribute("description", this.Description, _def_description);
                node.AddAttribute("prompt", this.Prompt, _def_prompt);
                node.AddAttribute("dataFieldSortOrder", this.SortOrder, _def_sortOrder);
                node.AddAttribute("default", this.Default, _def_default);
                node.AddAttribute("defaultIsFunc", this.DefaultIsFunc, _def_defaultIsFunc);

                if ((this.Length != _def_length) && !this.IsDefinedSize)
                {
                    node.AddAttribute("length", this.Length);
                }

                if (this.Scale != _def_scale && !this.IsDefinedScale)
                {
                    node.AddAttribute("scale", this.Scale);
                }

                node.AddAttribute("isIndexed", this.IsIndexed, _def_isIndexed);
                node.AddAttribute("isUnique", this.IsUnique, _def_isUnique);
                node.AddAttribute("id", this.Id);
                node.AddAttribute("type", (int)this.DataType);
                node.AddAttribute("allowNull", this.AllowNull, _def_allowNull);
                node.AddAttribute("obsolete", this.Obsolete, _def_obsolete);

                if (RelationshipRef != null)
                {
                    var relationshipRefNode = oDoc.CreateElement("relationshipRef");
                    RelationshipRef.XmlAppend(relationshipRefNode);
                    node.AppendChild(relationshipRefNode);
                }

                var parentTableRefNode = oDoc.CreateElement("pt");
                ParentTableRef.XmlAppend(parentTableRefNode);
                node.AppendChild(parentTableRefNode);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public override void XmlAppend(XmlNode node)
        {
            try
            {
                var oDoc = node.OwnerDocument;

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

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

                if (this.UseSearchObject != _def_useSearchObject)
                {
                    XmlHelper.AddAttribute((XmlElement)node, "useSearchObject", this.UseSearchObject.ToString());
                }

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

                if (this.CodeFacade != _def_codefacade)
                {
                    XmlHelper.AddAttribute(node, "codeFacade", this.CodeFacade);
                }

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

                var sqlNode = oDoc.CreateElement("sql");
                sqlNode.AppendChild(oDoc.CreateCDataSection(this.SQL));
                node.AppendChild(sqlNode);

                var parametersNode = oDoc.CreateElement("parameters");
                this.Parameters.XmlAppend(parametersNode);
                node.AppendChild(parametersNode);

                //if(RelationshipRef != null)
                //{
                //  XmlNode relationshipRefNode = oDoc.CreateElement("relationshipRef");
                //  RelationshipRef.XmlAppend(relationshipRefNode);
                //  node.AppendChild(relationshipRefNode);
                //}

                //XmlAttribute defaultVal = oDoc.CreateAttribute("default");
                //defaultVal.Value = this.Default;
                //node.Attributes.Append(defaultVal);

                //XmlAttribute length = oDoc.CreateAttribute("length");
                //length.Value = this.Length.ToString();
                //node.Attributes.Append(length);

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

                //XmlAttribute dataFieldFriendlyName = oDoc.CreateAttribute("dataFieldFriendlyName");
                //dataFieldFriendlyName.Value = this.FriendlyName;
                //node.Attributes.Append(dataFieldFriendlyName);

                //XmlAttribute dataFieldVisibility = oDoc.CreateAttribute("dataFieldVisibility");
                //dataFieldVisibility.Value = this.UIVisible.ToString();
                //node.Attributes.Append(dataFieldVisibility);

                //XmlAttribute dataFieldSortOrder = oDoc.CreateAttribute("dataFieldSortOrder");
                //dataFieldSortOrder.Value = this.SortOrder.ToString();
                //node.Attributes.Append(dataFieldSortOrder);

                var parentTableRefNode = oDoc.CreateElement("parentTableRef");
                ParentTableRef.XmlAppend(parentTableRefNode);
                node.AppendChild(parentTableRefNode);

                //XmlAttribute type = oDoc.CreateAttribute("type");
                //type.Value = this.Type.ToString("d");
                //node.Attributes.Append(type);

                //XmlAttribute allowNull = oDoc.CreateAttribute("allowNull");
                //allowNull.Value = this.AllowNull.ToString();
                //node.Attributes.Append(allowNull);

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