Provide a RequestHandler interface that returns IAsyncEnumerable
See original GitHub issueNow that we have C# 8.0, it would be nice if we had an interface such as IStreamRequestHandler<TRequest, TResponse>
with method
public async IAsyncEnumerable<TResponse> Handle(TRequest, CancellationToken)
{
}
Instead of needing another allocation for a Task<IAsyncEnumerble<TResponse>>
using the existing IRequestHandler<TRequest, IAsyncEnumerable<TResponse>>
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:31
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How can we use 'yield return' to return IAsyncEnumerable ...
Basically this method retrieve paginated data from MongoDB collection and convert it to byte array asynchronously and returns it to the caller. ...
Read more >IAsyncEnumerable with yield in C# - Code Maze
Let's learn about IAsyncEnumerable and the way to iterate over an IEnumerable collection asynchronously with the yield keyword.
Read more >Return iasyncenumerable from controller. IAsyncEnumerable ...
Return iasyncenumerable from controller. IAsyncEnumerable is used within an async method that uses the "yield" keyword. One advantage of using this type is ......
Read more >IAsyncEnumerable<T> Interface
Returns an enumerator that iterates asynchronously through the collection. Extension Methods. ConfigureAwait<T>(IAsyncEnumerable<T>, Boolean). Configures how ...
Read more >IAsyncEnumerable - C# Tutorial
It returns an IAsyncEnumerable <T> interface that iterates the sequences asynchronously. The IAsyncEnumerable<T> has the GetAsyncEnumerator() method that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah I’d like to open it up to feedback on the API and approach. It’s a big change 😃
How would you handle the difference in signature with the single Send
Should we do IStreamRequest and IStreamRequestHandler and stick to the Send() method for both IRequest and IStreamRequest both interfaces could inherit IBaseRequest but IMediator with have a method for both request types
as one Returns
Task<T>
and the other returnsIAsyncEnumerable<T>