public TResult[] GetNextPage() { TResult[] result = null; QueryFilter pagingFilter = null; bool retrievedAllData = true; if (!this.valid) { throw new InvalidOperationException("GetNextPage() called after reader was marked invalid"); } if (this.RetrievedAllData) { throw new InvalidOperationException(DirectoryStrings.ExceptionPagedReaderIsSingleUse); } try { pagingFilter = PagingHelper.GetPagingQueryFilter(this.filter, this.cookie); result = this.dataProvider.FindPaged <TResult>(pagingFilter, this.rootId, true, this.sortBy, this.pageSize).ToArray <TResult>(); } catch (PermanentDALException) { this.valid = false; this.RetrievedAllData = true; throw; } this.cookie = PagingHelper.GetProcessedCookie(pagingFilter, out retrievedAllData); this.RetrievedAllData = retrievedAllData; this.PagesReturned++; return(result); }
public IEnumerable <DataBlob> GetBlob(DataBlobVersion blobVersion, bool queryPrimaryOnly, ref string pageCookie, out bool complete, int pageSize = 10) { DataBlobSession.ValidateDataBlobVersionCommon(blobVersion, true); QueryFilter baseQueryFilter = QueryFilter.AndTogether(new QueryFilter[] { new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.DataTypeIdProperty, blobVersion.DataTypeId), new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.MajorVersionProperty, blobVersion.Version.Major), new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.MinorVersionProperty, blobVersion.Version.Minor), new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.BuildNumberProperty, blobVersion.Version.Build), new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.RevisionNumberProperty, blobVersion.Version.Revision), new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.BlobIdProperty, blobVersion.BlobId), new ComparisonFilter(ComparisonOperator.Equal, DataBlobCommonSchema.PrimaryOnlyProperty, queryPrimaryOnly) }); QueryFilter pagingQueryFilter = PagingHelper.GetPagingQueryFilter(baseQueryFilter, pageCookie); IEnumerable <DataBlob> result = this.dataProvider.FindPaged <DataBlob>(pagingQueryFilter, null, false, null, pageSize).Cast <DataBlob>().Cache <DataBlob>(); pageCookie = PagingHelper.GetProcessedCookie(pagingQueryFilter, out complete); return(result); }