public int Run() { var connectionId = _connectionIdArg.Value; var tables = _tablesArg.Value; var storage = new ConnectionStorage(_options.ConfigFilePath); var connection = storage.Get(connectionId); if (connection is null) { Console.WriteLine($"Connection not found: {connectionId}"); return(-1); } connection.Tables = tables; storage.AddUpdate(connectionId, connection); storage.SaveChanges(); if (!string.IsNullOrEmpty(tables)) { Console.WriteLine($"The connection [{connectionId}] is now filtered by tables: " + tables); } else { Console.WriteLine($"The connection's ({connectionId}) filter has been cleared"); } return(0); }
public int Run() { var storage = new ConnectionStorage(_options.ConfigFilePath); storage.Remove(_connectionIdArg.Value); storage.SaveChanges(); Console.WriteLine($"Connection {_connectionIdArg.Value} has been removed."); return(0); }
public int Run() { var storage = new ConnectionStorage(_options.ConfigFilePath); storage.AddUpdate(_arguments.ConnectionId, new ConnectionInfo(_arguments.ConnectionId, _arguments.DbType, _arguments.ConnectionString)); storage.SaveChanges(); Console.WriteLine($"Connection {_arguments.ConnectionId} has been added."); return(0); }