File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -183,22 +183,22 @@ Here's another example showing how to obtain the total count for the data to dis
183183``` cs
184184// Assuming we're in an api that should return admin users.
185185
186- // Do the initial query first.
186+ // Prepare the base query first.
187187var query = dbContext .Users .Where (x => x .IsAdmin );
188188
189189// This will be the count of all admins.
190190var count = await query .CountAsync ();
191191
192192// And then we apply keyset pagination at the end.
193- // You can optionally use the context object too as explained above to get additional info .
194- var keysetContext = dbContext . Users .KeysetPaginate (.. .);
195- var users = await keysetContext .Query
193+ // `KeysetPaginate` adds ordering and more predicates to the query so we have to get the count before we apply it .
194+ var keysetContext = query .KeysetPaginate (.. .);
195+ var admins = await keysetContext .Query
196196 .Take (20 )
197197 .ToListAsync ();
198- keysetContext .EnsureCorrectOrder (users );
199- ```
200198
201- ` KeysetPaginate ` adds ordering and more predicates to the query so we have to get the count before we apply it.
199+ // You can optionally use the context object too as explained above to get additional info.
200+ keysetContext .EnsureCorrectOrder (admins );
201+ ```
202202
203203## Avoiding skipping over data
204204
You can’t perform that action at this time.
0 commit comments