0

One particular controller that I have returns a Dataset as XML back to the client. This Dataset consists of 2 DataTables:

  1. Results: The results of a query
  2. Columns: Describe each column in results (eg. datatype, caption, alignment, etc)

I'm returning a dataset because I'm just returning exactly what comes back from the db. I'm not using DTO's or any mapping. The reason is because the query is built dynamically and columns will vary.

Currently I'm returning the top 50 results to limit the payload.

Is it possible to implement some kind of paging when using Datasets in such a way?

Ivan-Mark Debono
  • 15,500
  • 29
  • 132
  • 263
  • considering you're using web-api, couldn't you add a "page" property to the query string or message body and then do in code quantity = 50; page = page - 1; results = results.Skip(page * quantity).Take(quantity);? – Robert Nov 17 '14 at 14:27
  • I'm not using Linq to fetch records but building a SQL statement. Maybe I could use paging at the database level. – Ivan-Mark Debono Nov 17 '14 at 14:28
  • Ah, saw the EF tag so figured that might be an option. I haven't done it on the TSQL side, but this may help: http://stackoverflow.com/questions/109232/what-is-the-best-way-to-paginate-results-in-sql-server – Robert Nov 17 '14 at 14:30

0 Answers0