-
Notifications
You must be signed in to change notification settings - Fork 48
09.Page
1448376744 edited this page Sep 3, 2019
·
1 revision
using (var context = DbContextFactory.GetDbContext())
{
var page1 = context.From<User>()
.Skip(0, 10)
.Select();
var page2 = context.From<User>()
.Skip(10, 10)
.Select();
}
//SELECT id AS Id,is_delete AS IsDelete,balance AS Balance,nick_name AS NickName,create_time AS CreateTime FROM user LIMIT 0,10
//SELECT id AS Id,is_delete AS IsDelete,balance AS Balance,nick_name AS NickName,create_time AS CreateTime FROM user LIMIT 10,10
using (var context = DbContextFactory.GetDbContext())
{
var page1 = context.From<User>()
.Page(1,10,out long total1)
.Select();
var page2 = context.From<User>()
.Page(2, 10, out long total2)
.Select();
}
// SELECT COUNT(1) FROM user
// SELECT id AS Id,is_delete AS IsDelete,balance AS Balance,nick_name AS NickName,create_time AS CreateTime FROM user LIMIT 0,10
// SELECT COUNT(1) FROM user
// SELECT id AS Id,is_delete AS IsDelete,balance AS Balance,nick_name AS NickName,create_time AS CreateTime FROM user LIMIT 10,10