Exemple #1
0
        private static PagingPredicateHolder BuildHolder(ISerializationService serializationService,
                                                         PagingPredicate pagingPredicate, IData partitionKeyData)
        {
            var anchorList     = pagingPredicate.AnchorList;
            var anchorDataList = new List <KeyValuePair <IData, IData> >(anchorList.Count);
            var pageList       = new List <int>(anchorList.Count);

            foreach (var pair in anchorList)
            {
                pageList.Add(pair.Key);
                var anchorEntry = pair.Value;
                anchorDataList.Add(new KeyValuePair <IData, IData>(serializationService.ToData(anchorEntry.Key),
                                                                   serializationService.ToData(anchorEntry.Value)));
            }
            var anchorDataListHolder = new AnchorDataListHolder(pageList, anchorDataList);
            var predicateData        = serializationService.ToData(pagingPredicate.Predicate);
            var comparatorData       = serializationService.ToData(pagingPredicate.Comparer);

            if (!pagingPredicate.IterationType.HasValue)
            {
                throw new InvalidOperationException("The paging predicate does not specify an iteration type.");
            }

            return(new PagingPredicateHolder(anchorDataListHolder, predicateData, comparatorData, pagingPredicate.PageSize,
                                             pagingPredicate.Page, (byte)pagingPredicate.IterationType, partitionKeyData));
        }
Exemple #2
0
 public PagingPredicateHolder(AnchorDataListHolder anchorDataListHolder, IData predicateData, IData comparatorData,
                              int pageSize, int page, byte iterationTypeId, IData partitionKeyData)
 {
     AnchorDataListHolder = anchorDataListHolder;
     PredicateData        = predicateData;
     ComparatorData       = comparatorData;
     PageSize             = pageSize;
     Page             = page;
     IterationTypeId  = iterationTypeId;
     PartitionKeyData = partitionKeyData;
 }