WebApi icon indicating copy to clipboard operation
WebApi copied to clipboard

Implement support for IAsyncEnumerable

Open danielpastoor opened this issue 3 years ago • 4 comments

Should odata support IAsyncEnumerable? As when we use applyto on the server for example EntityFramework context.

Then we need to remap the data if there has been use of a select query.

Would it then be usefull to use IAsyncEnumerable to map and stream the data to the client at the samen time?

danielpastoor avatar Apr 19 '23 15:04 danielpastoor

@danielpastoor just to check whether I understand your request:

You want to be able to return an IAsyncEnumerable from a controller action and have support that the same way it does for IEnumerable (i.e. query processing with EnableQuery, OData result serialization, etc.), right?

habbes avatar Apr 25 '23 18:04 habbes

Yes that is right

danielpastoor avatar Apr 30 '23 16:04 danielpastoor

Ideally it would work the same as returning IQueryable where the select, filter etc applies to the returned results. And if there are no results post OData filtering then send nothing. This would be useful for streaming data changes, where the client decides how they want their data filtered/shaped.

I do think this would only support a subset though, as things like aggregations wouldn't make sense.

radderz avatar Oct 25 '23 05:10 radderz

It is already implemented in the asp.net core variant: https://github.com/OData/AspNetCoreOData/commit/fa81478df06c1fa16007ea43a47288cad2fd978a

danielpastoor avatar Nov 02 '23 16:11 danielpastoor