From 486b4ef4a09f15540f83a805e9645150ec22a6db Mon Sep 17 00:00:00 2001 From: 2881099 <2881099@qq.com> Date: Fri, 5 Aug 2022 13:30:02 +0800 Subject: [PATCH] update --- Pagination.md | 9 +++++++++ 分页查询.md | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/Pagination.md b/Pagination.md index 5e0dcf8..1fd958b 100644 --- a/Pagination.md +++ b/Pagination.md @@ -26,6 +26,15 @@ var list = fsql.Select() .Tolist(); ``` +> Count(out var total) is a synchronous method, because out does not support asynchrony. If you mind, you can execute it separately as follows: + +```c# +var select = fsql.Select() + .Where(a => a.Id > 10); +var total = await select.CountAsync(); +var list = await select.Page(1, 20).ToListAsync(); +``` + ## Optimization For the previous versions of `SqlServer 2012`, use `row_number` for pagination; diff --git a/分页查询.md b/分页查询.md index 33699d5..1132158 100644 --- a/分页查询.md +++ b/分页查询.md @@ -26,6 +26,15 @@ var list = fsql.Select() .Tolist(); ``` +> Count(out var total) 是同步方法,原因是 out 不支持异步,如果介意可以单独执行如下: + +```c# +var select = fsql.Select() + .Where(a => a.Id > 10); +var total = await select.CountAsync(); +var list = await select.Page(1, 20).ToListAsync(); +``` + ## 优化 `SqlServer 2012` 以前的版本,使用 `row_number` 分页;