protected virtual async Task EnsureIsLoadedAsync(CancellationToken cancellationToken = default) { if (_list == null) { if (SourceQuery is not IAsyncEnumerable <T> ) { // Don't call EF's async extension methods if query is not IAsyncEnumerable<T> EnsureIsLoaded(); return; } if (_totalCount == null) { _totalCount = await SourceQuery.CountAsync(cancellationToken); } if (_queryIsPagedAlready) { _list = await SourceQuery.ToListAsync(cancellationToken); } else { _list = await ApplyPaging().ToListAsync(cancellationToken); } } }
private async Task EnsureIsLoadedAsync() { if (_list == null) { if (_totalCount == null) { _totalCount = await SourceQuery.CountAsync(); } if (_queryIsPagedAlready) { _list = await SourceQuery.ToListAsync(); } else { _list = await ApplyPaging(SourceQuery).ToListAsync(); } } }
private async Task EnsureIsLoadedAsync(CancellationToken cancellationToken = default) { if (_list == null) { if (_totalCount == null) { _totalCount = await SourceQuery.CountAsync(cancellationToken); } if (_queryIsPagedAlready) { _list = await SourceQuery.ToListAsync(cancellationToken); } else { _list = await ApplyPaging(SourceQuery).ToListAsync(cancellationToken); } } }