简体   繁体   中英

WCF get List<CustomClass> row by row (streaming)

I have WCF service which return many rows from Mysql database. If get all rows at once I have some delay which not comfortable for me. I can open mysql datareader and get first rows very quickly but how return this rows to WCF client and continue get rows?

Is it possible make something like streaming but not for binary file stream but for some like List?

Main goal - at client side some thread call WCF stream method which returning row by row and proceed it.

PS Solution which call method with paging (offset in resultset and limit of rows) not so good because call mysql query each time for get portion of data very expensive.

Thanks for help.

I would suggest you have a look at WCF callbacks. Here is a good startign point:

What You Need To Know About One-Way Calls, Callbacks, And Events

You can make a callback to the client for each row you loaded from the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM