示例#1
0
        private void LoadSourceDbSchemaInfo()
        {
            this.tvSource.Nodes.Clear();

            DatabaseType  dbType        = this.GetDatabaseType(this.cboSourceDB.Text);
            DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(dbType, this.sourceDbConnectionInfo, new GenerateScriptOption());

            if (dbInterpreter is SqlServerInterpreter)
            {
                List <UserDefinedType> userDefinedTypes = dbInterpreter.GetUserDefinedTypes();

                if (userDefinedTypes.Count > 0)
                {
                    TreeNode userDefinedRootNode = new TreeNode("User Defined Types");
                    userDefinedRootNode.Name = nameof(UserDefinedType);
                    this.tvSource.Nodes.Add(userDefinedRootNode);

                    foreach (UserDefinedType userDefinedType in userDefinedTypes)
                    {
                        TreeNode node = new TreeNode();
                        node.Tag  = userDefinedType;
                        node.Text = $"{userDefinedType.Owner}.{userDefinedType.Name}";
                        userDefinedRootNode.Nodes.Add(node);
                    }
                }
            }

            TreeNode tableRootNode = new TreeNode("Tables");

            tableRootNode.Name = nameof(Table);
            this.tvSource.Nodes.Add(tableRootNode);

            List <Table> tables = dbInterpreter.GetTables();

            foreach (Table table in tables)
            {
                TreeNode tableNode = new TreeNode();
                tableNode.Tag  = table;
                tableNode.Text = dbInterpreter.GetObjectDisplayName(table, false);
                tableRootNode.Nodes.Add(tableNode);
            }

            TreeNode viewRootNode = new TreeNode("Views");

            viewRootNode.Name = nameof(DatabaseMigration.Core.View);
            this.tvSource.Nodes.Add(viewRootNode);

            List <DatabaseMigration.Core.View> views = ViewHelper.ResortViews(dbInterpreter.GetViews());

            foreach (var view in views)
            {
                TreeNode viewNode = new TreeNode();
                viewNode.Tag  = view;
                viewNode.Text = dbInterpreter.GetObjectDisplayName(view, false);
                viewRootNode.Nodes.Add(viewNode);
            }
        }
示例#2
0
        private void LoadSourceDbSchemaInfo()
        {
            this.tvSource.Nodes.Clear();

            DatabaseType  dbType        = this.GetDatabaseType(this.cboSourceDB.Text);
            DbInterpreter dbInterpreter = DbInterpreterHelper.GetDbInterpreter(dbType, this.sourceDbConnectionInfo, new GenerateScriptOption());

            if (dbInterpreter is SqlServerInterpreter)
            {
                TreeNode userDefinedRootNode = new TreeNode("User Defined Types");
                userDefinedRootNode.Name = nameof(UserDefinedType);
                this.tvSource.Nodes.Add(userDefinedRootNode);

                List <UserDefinedType> userDefinedTypes = dbInterpreter.GetUserDefinedTypes();
                foreach (UserDefinedType userDefinedType in userDefinedTypes)
                {
                    TreeNode node = new TreeNode();
                    node.Tag  = userDefinedType;
                    node.Text = $"{userDefinedType.Owner}.{userDefinedType.Name}";
                    userDefinedRootNode.Nodes.Add(node);
                }
            }

            TreeNode tableRootNode = new TreeNode("Tables");

            tableRootNode.Name = nameof(Table);
            this.tvSource.Nodes.Add(tableRootNode);

            List <Table> tables = dbInterpreter.GetTables();

            foreach (Table table in tables)
            {
                TreeNode tableNode = new TreeNode();
                tableNode.Tag  = table;
                tableNode.Text = dbInterpreter.GetDisplayTableName(table, false);
                tableRootNode.Nodes.Add(tableNode);
            }
        }
示例#3
0
 public List <Table> GetTables(params string[] tableNames)
 {
     return(Interpreter.GetTables(tableNames));
 }