Any more paging examples.

Posts   
 
    
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 12-Apr-2004 18:41:35   

Hi Guys,

I have searched through the forum and found 4 threads, but not really related to what we want to do.

I would really like to keep to the Entity collections using the DQE, so using Stored Proc is not really the answer, especially temp tables.

Want I would like to do is get n amount of records starting from x index in the filtered collection, I can't seem to find the syntax to do this. I hope don't mind but I am going to use Paul Wilsons mapper as an example (please do ban me from the forum simple_smile ). ObjectSpace ob = new ObjectSpace("mapping.config","connectionstring",Provider.MsSql,30,30);

ObjectQuery qry = new ObjectQuery(typeof(User),"WhereClause","SortClause",pageSize,pageIndex);

ob.GetObjectSet(qry);

This is kind of what I would like to do, is this available? If not can I submit it as a feature request. Also if not is there another way of doing it?

Paul's mapper was the reason for my LLBLGen Pro purchase and your excellent documentation, oh yes of course the product is sweet as well!

Cheers

Gareth

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 12-Apr-2004 19:10:23   

Paul is just looping through the resultset until the achieved results are found. This is not very efficient. simple_smile

Paging is on the to-do list.

You can add paging support to Adapter already in teh current code, by subclasses DataAccessAdapter, and overriding OnFetchEntityCollection() and manipulate the CommandText in hte query passed in to for example add code which adds the resultset to a temptable and selects from that temptable for the data to return. The temptable (or table variable in sqlserver 2000) contains the same columns as the resultset + 1 which is an autonumber field which you can use to select the right rows.

Frans Bouma | Lead developer LLBLGen Pro
Gareth
User
Posts: 24
Joined: 09-Apr-2004
# Posted on: 12-Apr-2004 19:36:45   

Thanks, I'll have a look.