// </AddItemsToContainerAsync> // <QueryItemsAsync> /// <summary> /// Run a query (using Azure Cosmos DB SQL syntax) against the container /// </summary> private async Task QueryDatabasesAsync() { var sqlQueryText = "SELECT * FROM d"; QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); Console.WriteLine("Running queries: {0}\n", sqlQueryText); Console.WriteLine($"{DateTime.Now:o}: cosmosClient.GetDatabaseQueryStreamIterator-QueryDefinition"); await ExecAndIterateQueryAsync(() => cosmosClient.GetDatabaseQueryStreamIterator(queryDefinition)); Console.WriteLine($"{DateTime.Now:o}: cosmosClient.GetDatabaseQueryStreamIterator-string"); await ExecAndIterateQueryAsync(() => cosmosClient.GetDatabaseQueryStreamIterator(sqlQueryText)); Console.WriteLine($"{DateTime.Now:o}: cosmosClient.GetDatabaseQueryIterator-QueryDefinition"); await ExecAndIterateQueryAsync(() => cosmosClient.GetDatabaseQueryIterator <DatabaseProperties>(queryDefinition)); Console.WriteLine($"{DateTime.Now:o}: cosmosClient.GetDatabaseQueryIterator-string"); await ExecAndIterateQueryAsync(() => cosmosClient.GetDatabaseQueryIterator <DatabaseProperties>(sqlQueryText)); }