I find myself doing FindAll or GetAll with Count and Pagination often.
at the moment i always do the following:
[code]
IRepository<XXX> repo;
int total = repo.Count(SomeQuery);
var result = repo.FindAll(SomeQuery, SomePagingOptions);
OR
int total = repo.Count();
var result = repo.GetAll(SomePagingOptions);
// note: if i do result.Count() i would only get count for the current page instead of the total count i wanted
[/code]
So my Questions:
1. does SharpRepository issue 2 queries to the underlying data source? one for Count, one for the FindAll or GetAll
2. if it does issue 2 queries, is there a way to optimize so that it does those in one go? Is there a better way?
Thanks in advance.