Paging with WCF data service

后端 未结 3 1171
不思量自难忘°
不思量自难忘° 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.

    0 讨论(0)
  • 2021-01-21 21:25

    Have a look at the Paging Provider for WCF Data Services here and here

    0 讨论(0)
  • 2021-01-21 21:26

    Unfortunately it seems that WCF data services is way too limited, and the solution for me was to switch to a regular WCF service so that I could use full LINQ and define data contracts myself.

    0 讨论(0)
提交回复
热议问题