示例#1
0
        public static Database LoadXml(XmlNode node)
        {
            Database db = null;

            if (node.Name == "Database")
            {
                db = new Database();
                if (node.Attributes["type"] != null)
                {
                    db = (Database)Utilities.Reflection.newType(node.Attributes["type"].Value);
                }
                foreach (XmlNode cNode in node.ChildNodes)
                {
                    switch (cNode.Name)
                    {
                    case "DatabaseType":
                        db.DatabaseType = DatabaseTypes.DB_TYPES.UNKNOWN;
                        if (cNode.InnerText != null)
                        {
                            db.DatabaseType = DatabaseTypes.convert(cNode.InnerText);
                        }
                        break;

                    case "Password":
                        Utilities.StringEx.setSecureString(db.Password, cNode.InnerText);
                        break;

                    case "UserName":
                        db.UserName = cNode.InnerText;
                        break;

                    case "Name":
                        db.Name = cNode.InnerText;
                        break;

                    case "ServerAddress":
                        db.ServerAddress = cNode.InnerText;
                        break;

                    case "ConnectionSettings":
                        db.Settings.LoadXml(cNode);
                        break;

                    case "Entities":
                        db.Entities.Clear();
                        foreach (XmlNode child in cNode.ChildNodes)
                        {
                            db.Entities.Add(Data.Entity.LoadXml(child));
                        }
                        break;

                    case "Queries":
                        db.Queries.Clear();
                        foreach (XmlNode child in cNode.ChildNodes)
                        {
                            db.Queries.Add(Data.Query.LoadXml(child));
                        }
                        break;
                    }
                }
            }
            return(db);
        }
示例#2
0
        public Type getDatabaseType()
        {
            Type type = DatabaseTypes.convert(DatabaseType);

            return(type);
        }