Exemple #1
0
        /// <summary>
        /// Creates an Xml element with the details of the table
        /// </summary>
        /// <param name="doc">The parent doc</param>
        /// <returns>XmlElement for the new document</returns>
        public XmlElement CreateDBML(DBMLDoc doc)
        {
            XmlElement table = doc.AddElement("Table");

            doc.AddAttributes(table, _elem.Attributes, string.Empty);

            XmlElement type = doc.AddElement("Type");

            doc.AddAttributes(type, _typeElem.Attributes, string.Empty);

            _cols.Sort();
            foreach (DBMLColumn c in _cols)
            {
                if (c.Found)
                {
                    type.AppendChild(c.CreateDBML(doc));
                }
            }

            doc.AddNodes(type, _typeElem.ChildNodes, "Column");
            table.AppendChild(type);

            doc.AddNodes(table, _elem.ChildNodes, "Type");
            return(table);
        }
Exemple #2
0
        /// <summary>
        /// Creates an Xml Element with the details of the column for a new DBML file
        /// </summary>
        /// <param name="doc">The parent document</param>
        /// <returns>An Xml Element cotaining the details of the column</returns>
        public XmlElement CreateDBML(DBMLDoc doc)
        {
            if (!_found)
            {
                return(null);
            }

            XmlElement col = doc.AddElement("Column");

            doc.AddAttribute(col, "Name", _name);
            doc.AddAttribute(col, "Type", clrType);
            doc.AddAttribute(col, "DbType", dbType);
            if (_isPrimaryKey)
            {
                doc.AddAttribute(col, "IsPrimaryKey", "true");
            }
            if (_isIdentity || _dbGenerated)
            {
                doc.AddAttribute(col, "IsDbGenerated", "true");
            }
            doc.AddAttribute(col, "CanBeNull", _canBeNull ? "true" : "false");

            if (_elem != null)
            {
                doc.AddAttributes(col, _elem.Attributes, COL_KNOWNATTR);
            }

            return(col);
        }
Exemple #3
0
        /// <summary>
        /// Creates an Xml element with the details of the table
        /// </summary>
        /// <param name="doc">The parent doc</param>
        /// <returns>XmlElement for the new document</returns>
        public XmlElement CreateDBML(DBMLDoc doc)
        {
            XmlElement table = doc.AddElement("Table");
            doc.AddAttributes(table, _elem.Attributes, string.Empty);

            XmlElement type = doc.AddElement("Type");
            doc.AddAttributes(type, _typeElem.Attributes, string.Empty);

            _cols.Sort();
            foreach(DBMLColumn c in _cols)
            {
                if(c.Found)
                    type.AppendChild(c.CreateDBML(doc));
            }

            doc.AddNodes(type, _typeElem.ChildNodes, "Column");
            table.AppendChild(type);

            doc.AddNodes(table, _elem.ChildNodes, "Type");
            return table;
        }