Exemple #1
0
        private void ShowDependenciesmenuItem_Click(object sender, EventArgs e)
        {
            Table table;
            DependencyTree deps;
            Scripter scripter;
            SqlSmoObject[] smoObjects = new SqlSmoObject[1];
            DependencyForm form = new DependencyForm();

            // Just make sure something is selected
            if (this.TableListView.SelectedIndices.Count == 0)
            {
                return;
            }

            // It's the first one as we only allow one selection
            table = (Table)(this.TableListView.SelectedItems[0].Tag);

            // Declare and instantiate new Scripter object
            scripter = new Scripter(table.Parent.Parent);

            // Declare array of SqlSmoObjects
            smoObjects[0] = table;

            // Discover dependencies
            deps = scripter.DiscoverDependencies(smoObjects, true);

            // Show dependencies
            form.ShowDependencies(table.Parent.Parent, deps);
            form.Show();
        }
Exemple #2
0
        private void DependenciesMenuItem_Click(object sender, EventArgs e)
        {
            Urn[] urns = new Urn[1];
            Scripter scripter;
            DependencyForm frm;
            DependencyTree deps;

            // Get the urn from the node
            urns[0] = (Urn)(this.DependenciesTreeView.SelectedNode.Tag);

            // Instantiate scripter
            scripter = new Scripter(server);

            // Get a new form
            frm = new DependencyForm();

            // Discover dependencies
            deps = scripter.DiscoverDependencies(urns, DependencyType.Parents);

            // Set the tree
            frm.ShowDependencies(server, deps);

            // Show the form
            frm.Show();
        }