Open GoogleCodeExporter opened 8 years ago
The trouble with the pagination stuff is that introduces a db dependent layer.
for sql server you use the nested query row_number trick, in denali we have
offset which simplifies
oracle and mysql have offset and limit
my current recommendation would be for us to ship a contrib library with
helpers for this, but it will not be in core dapper
Original comment by sam.saff...@gmail.com
on 7 May 2011 at 10:37
dapper contrib anyone? will need multiple providers for each db connection type
Original comment by sam.saff...@gmail.com
on 23 May 2011 at 12:32
Here's the code I'm using for MSSQL:
int pageIndex = 0;
int pageSize = 2;
int lower = (pageIndex * pageSize) + 1;
int upper = (pageIndex * pageSize) + pageSize;
string query =
@"
select * from (select p.*, row_number() over (order by Title) as rownum, count(*) over() as TotalRows
from portfolioprojects as p where p.Deleted = 0) seq
where seq.rownum between @x and @y";
var results =
cn.Query(query, new { x = lower, y = upper });
It would be nice to have a helper for this (for each provider).
Original comment by b...@planetcloud.co.uk
on 29 May 2011 at 11:48
Original comment by sam.saff...@gmail.com
on 1 Jun 2011 at 9:06
You should checkout https://github.com/TroyGoode/PagedList it's awesome
and works pretty great combined with dapper.
Original comment by peter.su...@gmail.com
on 4 Jul 2013 at 1:13
Original issue reported on code.google.com by
estee...@gmail.com
on 6 May 2011 at 12:31