AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

TruncatedCollection does not implement IAsyncEnumerable

Open dsidedp opened this issue 4 years ago • 1 comments

The code below will fail:

var settings = new ODataQuerySettings() { PageSize = 10 };
var items = await query.ApplyTo(data, settings).Cast<object>().ToListAsync(ct);

Exception: The source 'IQueryable' doesn't implement 'IAsyncEnumerable<System.Object>'. Only sources that implement 'IAsyncEnumerable' can be used for Entity Framework asynchronous operations.

The issue is: TruncatedCollection (which is used when PageSize is provided) does not implement IAsyncEnumerable

Version: 8.0.1

dsidedp avatar Jul 25 '21 07:07 dsidedp

TruncatedCollection cannot implement IAsyncEnumerable<T> because it inherits from List<T>, but I wonder why it works this way. Is there not a way to paginate elements via IQueryable<T> like it happens with $expand and $select which have their own wrappers?

Xriuk avatar Nov 12 '24 13:11 Xriuk