Back to list
Views:   7.9K
Replies:  1
Archived

WCF Webservice Result Set with Server Side Paging


Are there any patterns or examples on how to implement server side paging for webservice calls that returns large number of records back to the client?
Yassin Khan, Nov 09, 2011
Reply 1
This is what I use:
public List<BlogApp6.BusinessObjects.Blog> GetAll(
    string sortExpression, int startRowIndex, int maximumRows)
{
    using (var context = DataObjectFactory.CreateContext())
    {
        IQueryable<BlogApp6.DataObjects.EntityFramework.Blog> query = 
            context.Blogs.AsQueryable().OrderBy(sortExpression);
            
        query = query.Skip(startRowIndex).Take(maximumRows);
        
        var list = new List<BlogApp6.BusinessObjects.Blog>();
        
        foreach (BlogApp6.DataObjects.EntityFramework.Blog entity in query)
            list.Add(BlogMapper.ToBusinessObject(entity));
        
        return list;
    }
}

I hope this helps.
King Wilder, Dec 08, 2011


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas.      Vsn 1.2.2