简体   繁体   中英

subsonic 3 active records paging

I am trying to get the 10 latest rows in Subsonic 3.0 Active Records.

I want to page, so I could really use a method like this:

var blogcoll = blog.GetPaged(1, 10);

The problem with the GetPaged() method is that you can't page in a descending order.

Instead of the first 10 id's i want the last 10 id's

Am I missing something?

is there another way?

I came up with this LINQ solution for my problem:

(page is an integer parameter)

var blogcoll = blog.All().OrderByDescending(x => x.idBlog).Skip((page - 1) * 10).Take(10).ToList<blog>();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM