Issue:
GetTotalItems() method on an EntityProvider object uses the same SQL as the Get() methods, which results in an entire record set being retrieved when all that is needed is to get a Count of the items in the database table.
Workaround:
Call the GetPaged()method directly, but only specify a pageLength of 1. The out parameter of the method will contain the correct count. Example: (Using AdventureWorks DB)
int retVal;
TList<Product> prod = DataRepository.ProductProvider.GetPaged(0,1, out retVal);
return retVal;This still returns a single entity item (if any exist), but this is at least more efficient than returning an entire table's data to simply get a count.