Browse Source

Update ToPageListAsync(+1)

pull/18/MERGE
sunkaixuan 3 years ago
parent
commit
4f12f96c2b
  1. 7
      Src/Asp.Net/SqlServerTest/UnitTest/UQueryable.cs
  2. 6
      Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

7
Src/Asp.Net/SqlServerTest/UnitTest/UQueryable.cs

@ -265,6 +265,13 @@ namespace OrmTest
//}).ExecuteCommand();
var d1111111111111 = db.Queryable<SqlSugarDemo.UserEntity>()
.Mapper<SqlSugarDemo.UserEntity, SqlSugarDemo.RoleEntity, SqlSugarDemo.UserRoleEntity>(it => ManyToMany.Config(it.UserId, it.RoleId)).InSingle(data.UserId);
RefAsync<int> x11 = 0;
RefAsync<int> y1 = 0;
db.Queryable<Order>().ToPageListAsync(1, 2, x11, y1).GetAwaiter().GetResult();
if (x11.Value > 0 && y1.Value == 0)
{
throw new Exception("unit test error");
}
}

6
Src/Asp.Net/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs

@ -2122,10 +2122,10 @@ namespace SqlSugar
this.Context.MappingTables = oldMapping;
return await this.Clone().ToPageListAsync(pageIndex, pageSize);
}
public Task<List<T>> ToPageListAsync(int pageNumber, int pageSize, RefAsync<int> totalNumber, RefAsync<int> totalPage)
public async Task<List<T>> ToPageListAsync(int pageNumber, int pageSize, RefAsync<int> totalNumber, RefAsync<int> totalPage)
{
var result = ToPageListAsync(pageNumber, pageSize, totalNumber);
totalPage.Value = (totalNumber + pageSize - 1) / pageSize;
var result =await ToPageListAsync(pageNumber, pageSize, totalNumber);
totalPage.Value = (totalNumber.Value + pageSize - 1) / pageSize;
return result;
}
public async Task<string> ToJsonAsync()

Loading…
Cancel
Save