开发者

Read N consequent items by ActiveRecord

My project is C# and uses CastleProject ActiveRecord on MS SQL Server database.

I need to retrieve N consequent items from the database, sorted by some criteria, started from some value.

Example: I have a lot of messages in some table, where message has ID, time and text. I'd like to retrieve messages with position from 100 to 120, when they are sorted by time.

I cannot read all messages, and then sort开发者_StackOverflow中文版 and find on a client because there may be many messages in database (say it, a million of).

Is it possible to achieve with ActiveRecord means or only with stored procedures on SQL Server?


Assuming your AR class is MyItem and it inherits ActiveRecordBase<T>:

MyItem[] items = MyItem.SlicedFindAll(100, 20, new[] {Order.Asc("time")});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜