Part of DKNet.EfCore.Specifications. Use the ordered Quick Start specification for buffered streaming or a repository cursor page:
await foreach (var product in repo.ToPageEnumerable(new MinimumPrice(0)))
Console.WriteLine(product.Name); // Coffee, then Tea
var next = await repo.ToKeysetPageAsync(new MinimumPrice(0), p => p.Id, cursor: 1, pageSize: 20);
Console.WriteLine(next.Single().Name); // Tea
| Surface | Ordering owner | Result |
|---|---|---|
repo.ToPagedListAsync(spec, pageNumber, pageSize) |
Specification | X.PagedList page; page number is 1-based. |
repo.ToPageEnumerable(spec) |
Specification, required | Async rows buffered in offset pages of 100. |
query.AfterKeyset / BeforeKeyset |
Caller | WHERE only; one or two ascending, comparable value-type keys. |
repo.ToKeysetPageAsync |
Specification, not enforced | List after a one-key or two-key ascending cursor. |
query.ToKeysetPageAsync(configureKeyset, ...) |
Configure delegate | KeysetPage<TEntity> with Items, HasPrevious, HasNext. |
The queryable arbitrary-key overload uses MR.EntityFrameworkCore.KeysetPagination, supports mixed directions and forward/backward navigation, and accepts an optional reference object with matching key property names. It owns ordering as well as filtering. The two-key helper uses a lexicographic OR comparison with an additional leading bound on the first key; cursor values are captured as parameters.
| Input | Type | Default | Effect |
|---|---|---|---|
| Buffered page size | Internal constant | 100 |
Not exposed by repository enumeration helpers. |
pageSize for keysets |
int |
Required | Must be positive; otherwise throws ArgumentOutOfRangeException. |
Arbitrary-key direction |
KeysetPaginationDirection |
Forward |
Cursor navigation direction. |
Arbitrary-key reference |
object? |
null |
Null selects the initial page. |
| Async cancellation | CancellationToken |
Default | Observed by row materialization/enumeration; arbitrary-key existence checks do not accept it. |
The query architecture shows the shared DbContext. Both entity and projected repository queries offer paged lists and buffered enumeration; keyset repository helpers return entities.
repo.ToPageEnumerable requires at least one declared order clause, otherwise NotSupportedException is thrown. Choose a unique tie-breaker for stable pages.repo.ToKeysetPageAsync relies on the specification’s ordering and does not enforce it. Without an order clause it runs without ORDER BY, raises no error and returns rows in no fixed order.>/<, so a string key throws.