private static ConnectionInfo ConvertToConnectionInfo(ConnectionConfigurationElement configurationElement) { ArgumentChecks.AssertNotNull(configurationElement, nameof(configurationElement)); var pluginIdentifier = configurationElement.DbServerPluginInfo; var pluginResult = DbServerPluginRegistry.GetPluginByIdentifier(pluginIdentifier); if (!pluginResult.HasValue) { var message = string.Format( CultureInfo.CurrentCulture, Messages.PluginNotFound, pluginIdentifier); throw new SnapshotException(message); } var connection = new ConnectionInfo( pluginResult.Value, configurationElement.Host, configurationElement.UsesIntegratedSecurity, configurationElement.UserId, configurationElement.Password); return(connection); }
private void AddConnectionButton_Click(object sender, RoutedEventArgs e) { var newConnectionDialog = new NewConnectionDialog(); var result = newConnectionDialog.Prompt(DbServerPluginRegistry.GetAllPlugins()); if (result.HasValue) { // Add to connection repo. this._connectionRepository.AddConnection(result.Value); // Load databases. HandleResult(this._databaseRepository.TryLoadDatabases(result.Value)); this.UpdateConnectionsListView(); this.UpdateDatabaseListView(); } }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.InitializeComponent(); // Quick hack... DbServerPluginRegistry.RegisterPlugin( MsSql2014.Identifier, new MsSql2014DbServerInfo(), new MsSql2014DatabaseServices(), new MsSql2014SnapshotServices()); this._connectionRepository = new ConnectionRepository(); this._databaseRepository = new DatabaseRepository(); this._snapshotRepository = new SnapshotRepository(); this.UpdateButtonStatus(); }