private static ISink CreateSink(string commandName, AbstractCommandLineOptions options) { if (!string.IsNullOrEmpty(options.ConnectionString)) { string tableName = string.IsNullOrEmpty(options.DatabaseTableName) ? commandName : options.DatabaseTableName; return(new DatabaseSink(options.ConnectionString, tableName, options.CollectionUrl)); } return(new TextWriterSink(System.Console.Out)); }
private static VssConnection CreateConnection(AbstractCommandLineOptions options) { VssCredentials creds; if (!string.IsNullOrEmpty(options.PersonalAccessToken)) { creds = new VssBasicCredential(string.Empty, options.PersonalAccessToken); } else if (!string.IsNullOrEmpty(options.Username)) { creds = new VssCredentials(new WindowsCredential(new NetworkCredential(options.Username, options.Password))); } else { creds = new VssCredentials(new WindowsCredential(true)); } return(new VssConnection(new Uri(options.CollectionUrl), creds)); }