异步分页获取总数total为0 返回

SqlSugar 老数据
5 1621
该叫什么 Ren 发布于2021/5/21
悬赏:20 飞吻

public virtual async Task<List<TEntity>> QueryCodeName(string inCode, string inName, int inPageIndex, int inPageSize)

        {

            RefAsync<int> total = 0;

            var data = this.Db.Queryable<TEntity>();

            data.Where(a => a.IsDelete == false);

            if (!string.IsNullOrEmpty(inCode))

            {

                data.Where(a => a.Code.Contains(inCode));

            }

            if (!string.IsNullOrEmpty(inName))

            {

                data.Where(a => a.Name.Contains(inName));

            }


            var table = data.ToPageListAsync(inPageIndex, inPageSize, total);

            return await table;

        }


热忱回答5

  •       couts = total; 你这个定有什么用呢 

    0 回复
  • 异步是不能这么返回的 

    0 回复
  • Ren Ren VIP0
    2021/5/21

    @fate stay nightcouts = total;这一步 忘了去掉了    那我是该怎么返回呢  大佬求教

    0 回复
  • Task<List<TEntity>>  你的返回值没有返回的地方

    0 回复
  • 香香 香香 VIP0
    2023/5/4

    碰到了同样的问题, 楼主是怎么解决的呢


    0 回复