IAsyncEnumerable as Stateful Service method return value?

Miloš D. Ljubisavljević 1 Reputation point
2020-12-17T18:13:07.667+00:00

Is there a way to return IAsyncEnumerable in Stateful Service method, like in regular ASP .NET Core services?
Returning large amounts of rows from db is getting really slow using Task<IEnumerable<>>.

I tried doing that using Task<Fabric.IAsyncEnumerable> but I still dont get expected results, and also couldnt find any solution online. If this is expected and I am mistaken, please point me to the right solution.

Azure Service Fabric
Azure Service Fabric
An Azure service that is used to develop microservices and orchestrate containers on Windows and Linux.
291 questions
{count} votes

1 answer

Sort by: Most helpful
  1. prmanhas-MSFT 17,946 Reputation points Microsoft Employee Moderator
    2020-12-28T16:10:52.597+00:00

    @Miloš D. Ljubisavljević Posting as answer for broader community reach.

    IAsyncEnumerable is remotable or streamable, but what most people do is return data in segments or chunks, with the client being able to know how far it has made it and then request more data from where it left off.

    Hope it helps!!!

    Please "Accept as Answer" so it can help others in community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.