Closed vamsi200989 closed 3 months ago
Using collections in the keyset is not supported. Even if it was, it defeats the goal of using keyset pagination as it's adding a join in the base condition of the query that can't be satisfied with an index, leading to a table scan.
A solution is to create a computed column that stores Addresses.First().City
and add this column to the keyset (an example of this is shown in caveats.md). This way you can index this column and you can use it in the keyset as any other column.
I'm closing this, please reopen if you still have issues.
I am encountering an issue with keyset pagination using the MR.EntityFrameworkCore.KeysetPagination library when dealing with nested collections. Specifically, I am trying to paginate PaymentRequest entities sorted by RemittanceDetail.Number, but I encounter an exception.
Set Up the Keyset Query:
Sample Code
Failure :
This fails in HasNextAsync method with the following exception :
**System.ArgumentException: Expression of type 'System.Collections.Generic.List
1[<>f__AnonymousType61[System.String]]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable
1[Namespace.NestedEntityType]' of method 'Namespace.NestedEntityType FirstNestedEntityType'**`The example provided in the Readme for Loose Typing is simple, it just have a navigation property but in our case we have a collection and there is no example on how to deal with nested collections.
Could you please provide an example on how to sort with properties in the nested collection ?