/// <summary> /// Gets a list of all the databases in the current context. /// </summary> /// <returns>An array of databases in the current context</returns> public Database[] GetDatabases() { this.clientRequestId = SqlDatabaseManagementHelper.GenerateClientTracingId(); ISqlDatabaseManagement channel = GetManagementChannel(); SqlDatabaseList databases = channel.EndGetDatabases( channel.BeginGetDatabases(this.subscriptionId, this.ServerName, null, null)); List <Database> results = new List <Database>(); foreach (var db in databases) { //Create the database from the response results.Add(CreateDatabaseFromResponse(db)); } return(results.ToArray()); }