Paging with WCF data service

后端 未结 3 1172
不思量自难忘°
不思量自难忘° 2021-01-21 20:49

My question is about how you handle paging with a WCF data service. The way I want to use it, is execute a query (passing page size and current page), and get back the results o

3条回答
  •  鱼传尺愫
    2021-01-21 21:18

    Use Skip and Take to perform client side paging of data from the WCF data service, such as:

    var items = (from i in ctx.MyEntities
                 select i).Skip(StartIndex).Take(PageSize)
    

    Where StartIndex is the beginning position of the data you want returned and PageSize is the number of elements max to return.

提交回复
热议问题