Ejemplo n.º 1
0
        protected override IList <TreeNodeBase> GetNodes()
        {
            var nodes      = new List <TreeNodeBase>();
            var tablesNode = new TablesTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(tablesNode);
            var viewsNode = new ViewsTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(viewsNode);
            var indexesNode = new IndexesTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(indexesNode);
            var constraintsNode = new ConstraintsTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(constraintsNode);
            var functions = new FunctionsTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(functions);
            var sequencesNode = new SequencesTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(sequencesNode);
            var synonymsNode = new SynonymsTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(synonymsNode);
            var triggerssNode = new TriggersTreeNode(Schema, DatabaseConnection, DatabaseInstance);

            nodes.Add(triggerssNode);
            return(nodes);
        }
Ejemplo n.º 2
0
        protected override IList <TreeNodeBase> GetNodes()
        {
            try
            {
                var actionName = string.Format("Attempting to connect to {0} ...", DatabaseConnection.Name);
                _log.Debug(actionName);
                using (new WaitActionStatus(actionName))
                {
                    _log.DebugFormat("Creating connection for {0} ...", DatabaseConnection.Name);
                    using (var connection = DatabaseConnection.CreateNewConnection())
                    {
                        connection.OpenIfRequired();
                        DatabaseConnection.Connect();
                        _log.Debug("Connection is successful.");

                        var nodes       = new List <TreeNodeBase>();
                        var dummySchema = new Schema();
                        var tablesNode  = new TablesTreeNode(dummySchema, DatabaseConnection, DatabaseInstance);
                        nodes.Add(tablesNode);
                        var viewsNode = new ViewsTreeNode(dummySchema, DatabaseConnection, DatabaseInstance);
                        nodes.Add(viewsNode);
                        var indexesNode = new IndexesTreeNode(dummySchema, DatabaseConnection, DatabaseInstance);
                        nodes.Add(indexesNode);
                        return(nodes);
                    }
                }
            }
            catch (Exception ex)
            {
                DatabaseConnection.Disconnect();
                _log.ErrorFormat("Error opening connection and loading data.");
                _log.Error(ex.Message, ex);
                throw;
            }
        }