Skip to content
sunkaixuan edited this page May 4, 2019 · 5 revisions

Convert Sql to Queryable

1.Page

int total=0;
var list = db.SqlQueryable<Student>("select * from student").ToPageList(1, 2,ref total);

2.Where

//by expression
var list= db.SqlQueryable<Student>("select * from student").Where(it=>it.Id==1).ToPageList(1, 2);
//by sql
var list= db.SqlQueryable<Student>("select * from student").Where("id=@id",new { id=1}).ToPageList(1, 2);
Clone this wiki locally