AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

IAsyncEnumerable not queryable

Open danielpastoor opened this issue 2 years ago • 1 comments

When I use the IAsyncEnumerable with a $filter query. Then I get the error that I can't use $filter on a single item but it is on multiple items

[EnableQuery]
public IasyncEnumerable<Test> GetTests() {
Foreach(var item in new List<Test>().AsQueryable()) {
 yield return item;
}
}

danielpastoor avatar Nov 06 '23 08:11 danielpastoor

When using IAsyncEnumerable, you use an await foreach to enumerate it. Also, AsQueryable() will return an IQueryable that does not implement the IAsyncEnumerable. You should instead use AsAsyncEnumerable(). This seems to be a bug though.

ElizabethOkerio avatar Nov 07 '23 07:11 ElizabethOkerio