protected void OnDisconnectConnection()
        {
            DatabaseConnectionContext context = (DatabaseConnectionContext)CurrentNode.DataItem;

            if (context.HasConnectionPool)
            {
                context.ConnectionPool.Close();
                context.Refresh();
                CurrentNode.Expanded = false;
            }
        }
Example #2
0
        protected void OnEditConnection()
        {
            DatabaseConnectionContext  context = (DatabaseConnectionContext)CurrentNode.DataItem;
            DatabaseConnectionSettings newSettings;

            if (context.DbFactory.GuiProvider.ShowEditConnectionDialog(context.DbFactory,
                                                                       context.ConnectionSettings,
                                                                       out newSettings))
            {
                DatabaseConnectionContext newContext = new DatabaseConnectionContext(newSettings);
                ConnectionContextService.RemoveDatabaseConnectionContext(context);
                ConnectionContextService.AddDatabaseConnectionContext(newContext);
                newContext.Refresh();
            }
        }
Example #3
0
        public override void RenameItem(string newName)
        {
            DatabaseConnectionContext context = (DatabaseConnectionContext)CurrentNode.DataItem;

            if (context.ConnectionSettings.Name != newName)
            {
                if (ConnectionContextService.DatabaseConnections.Contains(newName))
                {
                    MessageService.ShowError(String.Format(
                                                 "Unable to rename connection '{0}' to '{1}'! (duplicate name)",
                                                 context.ConnectionSettings.Name, newName
                                                 ));
                }
                else
                {
                    context.ConnectionSettings.Name = newName;
                    context.Refresh();
                }
            }
        }