GithubHelp home page GithubHelp logo

Comments (4)

jsquire avatar jsquire commented on September 24, 2024

Hi @JicoDotNet. Thank you for reaching out and we regret that you're experiencing difficulties. The method signatures are correct. They are intended to represent an IAsyncEnumerable<T> that you can iterate through rather than a Task<T>. Your application would consume this in the same way as the Query Tables example demonstrates, but using the asynchronous form:

AsyncPageable<TableItem> queryTableResults = serviceClient.QueryAsync(filter: $"TableName eq '{tableName}'");
Console.WriteLine("The following are the names of the tables in the query results:");

// Iterate the <see cref="Pageable"> in order to access queried tables.

await foreach (TableItem table in queryTableResults)
{
    Console.WriteLine(table.Name);
}

More information can be found in Iterating with Async Enumerables in C# 8.

from azure-sdk-for-net.

github-actions avatar github-actions commented on September 24, 2024

Hi @JicoDotNet. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

from azure-sdk-for-net.

JicoDotNet avatar JicoDotNet commented on September 24, 2024

Hi @jsquire, Thanks for your support. Can you please help me on the code below. I'm getting an error for this code block.

public async Task<List<Person>> GetPersons(string Query)
{
    try
    {
        TableServiceClient tableServiceClient = new TableServiceClient("my_storage_account_connection_string");
        TableClient myTableClient = tableServiceClient.GetTableClient("my_table_name");
        return await myTableClient.QueryAsync<Person>(Query).ToBlockingEnumerable().ToList();
    }
    catch (Exception)
    {
        throw;
    }
}

Receiving below ERROR.

Error CS1061 'List' does not contain a definition for 'GetAwaiter' and no accessible extension method 'GetAwaiter' accepting a first argument of type 'List' could be found (are you missing a using directive or an assembly reference?)

from azure-sdk-for-net.

jsquire avatar jsquire commented on September 24, 2024

The standard ToList only works with IEnumerable<T>, not with IAsyncEnumerable<T>. Your options would be to consider using a package like System.Linq.Async to give you assess to ToListAsync() or you would need to write your own loop to do the conversion:

var results = new List<TableItem>();
var queryTableResults = serviceClient.QueryAsync(filter: $"TableName eq '{tableName}'");

await foreach (TableItem table in queryTableResults)
{
    results.Add(table);
}

from azure-sdk-for-net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.