Paging with Find using Active Record
Posted
by Brian Rizzo
on Stack Overflow
See other posts from Stack Overflow
or by Brian Rizzo
Published on 2010-05-10T01:05:24Z
Indexed on
2010/05/10
1:08 UTC
Read the original article
Hit count: 435
subsonic-active-record
|subsonic3
I can't seem to find an answer to this question or a good example of how to accomplish what I am trying to do. I'm sure it's been posted or explained somewhere, but I am having trouble finding the exact solution I need.
I am using ActiveRecord in Subsonic 3.0.0.3. When I do something like
recordset = VehicleModel.Find(x => x.Model.StartsWith(SearchText));
I get back an IList of VehicleModel objects (or more simply a recordset), this is fine until I return too many records. I also cannot order the returned set of records (my grid will do this fine, but i'm sure it will be too slow if i have too many records). Being that Find is returning an IList there isn't much that I can run directly against this (again I may be overlooking something simple so please don't kill me).
My question is can someone explain how to find data like i am above, sort it and get a page of data where a page is of size n?
Am I going about this wrong? Am I even close to being on the right track?
© Stack Overflow or respective owner