Get a large <T> list from WCF in pieces?

I am trying to get a list of entities from a WCF service, the problem I am facing is that we have some bad latency on the network, and therefore the data takes a considerable amount of time to reach my client. The idea I have is to find a way to get the first 1000 and just push them to the user interface while I wait for the next following events.

I assume this will be like paging, but I just want to put the full set in the WCF layer and then get one page at a time from db

Greetings

+7
source share
3 answers

In the end, when I use tcpTransport for my communication, I ended up using duplex channels to do what I need.

I just changed my current SearchMethod, which was returning a large list to the void. Inside this method, I get my data from the database, unload it and send it to the client using the callback operation

0
source

WCF scans the entire message before passing it to higher levels. Therefore, your data must be received in full, and normal WCF contracts will not work.

However, you can use streaming with WCF . This allows the payload to be read out gradually from the stream and transferred to higher levels. To get a job, you need to:

  • enable streaming (in
+6
source

You can always divide your service interface into two methods. For example, instead of:

List<T> GetItems() 

You may have:

 int GetItemCount() List<T> GetItems(int start, int maxSize) 

So you can do the swap manually.

+3
source

All Articles