Otis wrote:
when distinct can't be applied to the query, client side paging is used IF there is a join because you then get duplicates and thus paging will give incorrect results.
Yes I can understand that... but if you know the JOIN will not contains any duplicates because of the filter being applied, you then don't have a way of specifying "allowDuplicates" for the FetchEntityCollection method. I can also see the reasoning why this has been ommitted
I use the FetchEntityCollection method because I can attach a lot of prefetches which I cannot do with a TypedView or TypedList:
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.ItemEntity);
prefetchPath.Add(ItemEntity.PrefetchPathTagCollection);
prefetchPath.Add(ItemEntity.PrefetchPathItemCommentCollection).SubPath.Add( ItemCommentEntity.PrefetchPathCreatedByAccountUser).SubPath.Add(AccountUserEntity.PrefetchPathAccountSummary);
prefetchPath.Add(ItemEntity.PrefetchPathDefaultLicense);
prefetchPath.Add(ItemEntity.PrefetchPathLicenseCollection);
The tables concerned have millions of rows and although the average filter limits this to 50K or so, we cannot bring all these rows back to the middle tier... which is why we employ paging.
As far as I can tell the only way around this would be for me to subclass DataAccessAdapter and provide a new FetchEntityCollection overload which takes the paging parameters as well as an allowDuplicates flag. The following code would then need to be altered in order to pass the flag into the CreateSelectDQ method instead of the hardcoded true / false.
if(relationsPresent)
{
selectQuery=CreateSelectDQ(fieldsForQuery,
persistenceInfo, predicateExpressionToUse, maxNumberOfItemsToReturn, sortClauses, filterBucketToUse.Relations, false, null, pageNumber, pageSize);
}
else
{
selectQuery=CreateSelectDQ(fieldsForQuery,
persistenceInfo, predicateExpressionToUse, maxNumberOfItemsToReturn, sortClauses, null, true, null, pageNumber, pageSize);
}
Is this something you would consider appropriate to be included in the product or shall I go ahead and implement this myself...
Marcus