Пример #1
0
        private SimpleConstraint _ParseSimpleConstraint(XPathNavigator simpleConstraintNav, bool isPrimaryKey, int index)
        {
            SimpleConstraint sc;
            List <Column>    localColumnList = new List <Column>();

            foreach (XPathNavigator colNav in simpleConstraintNav.Select("rc:Column", _vulcanConfig.NamespaceManager))
            {
                Column c = new Column();
                foreach (XPathNavigator nav in colNav.Select("@*"))
                {
                    c.Properties.Add(nav.Name, nav.Value);
                }
                localColumnList.Add(c);
            }

            if (isPrimaryKey)
            {
                string name = String.Format(System.Globalization.CultureInfo.InvariantCulture, "PK_{0}_{1}", _name, index, localColumnList);
                sc = new PrimaryKeyConstraint(name, localColumnList);
            }
            else
            {
                string name = String.Format(System.Globalization.CultureInfo.InvariantCulture, "CON_{0}_{1}", _name, index, localColumnList);
                sc = new SimpleConstraint(name, localColumnList);
            }

            foreach (XPathNavigator attributeNav in simpleConstraintNav.Select("@*"))
            {
                sc.Properties.Add(attributeNav.Name, attributeNav.Value);
            }
            return(sc);
        }
Пример #2
0
        private SimpleConstraint _ParseSimpleConstraint(XPathNavigator simpleConstraintNav, bool isPrimaryKey, int index)
        {
            SimpleConstraint sc;
            List<Column> localColumnList = new List<Column>();

            foreach (XPathNavigator colNav in simpleConstraintNav.Select("rc:Column", _vulcanConfig.NamespaceManager))
            {
                Column c = new Column();
                foreach (XPathNavigator nav in colNav.Select("@*"))
                {
                    c.Properties.Add(nav.Name, nav.Value);
                }
                localColumnList.Add(c);
            }

            if (isPrimaryKey)
            {
                string name = String.Format(System.Globalization.CultureInfo.InvariantCulture, "PK_{0}_{1}", _name, index, localColumnList);
                sc = new PrimaryKeyConstraint(name, localColumnList);
            }
            else
            {
                string name = String.Format(System.Globalization.CultureInfo.InvariantCulture, "CON_{0}_{1}", _name, index, localColumnList);
                sc = new SimpleConstraint(name, localColumnList);
            }

            foreach (XPathNavigator attributeNav in simpleConstraintNav.Select("@*"))
            {
                sc.Properties.Add(attributeNav.Name, attributeNav.Value);
            }
            return sc;
        }