views:

11

answers:

1

I'm thinking about how to design my service, especially the part which will provide data for an gridview on the clien side.

The GridView needs this data:

-A list of objects

-Count of all records

The question is:

Should I create one method for getting these data which will return an object which would includes the count and the list. Or rather create two separate methods,one for the list and one for the count.

  1. int Getcount() and GetAll(int page,int pageSize)
  2. Response GetResponse(int page,int pageSize)
A: 

Personally, I prefer the second option as it is clearer and you do not need several round trips to the server. Furthermore, it takes into account that the number of records can change while viewing a chunk of data.

Obalix