Пример #1
0
        public static FeedRangeIteratorCore Create(
            ContainerInternal containerCore,
            FeedRangeInternal feedRangeInternal,
            string continuation,
            QueryRequestOptions options,
            ResourceType resourceType       = ResourceType.Document,
            QueryDefinition queryDefinition = null)
        {
            if (!string.IsNullOrEmpty(continuation))
            {
                if (FeedRangeContinuation.TryParse(continuation, out FeedRangeContinuation feedRangeContinuation))
                {
                    return(new FeedRangeIteratorCore(containerCore, feedRangeContinuation, options, resourceType, queryDefinition));
                }

                // Backward compatible with old format
                feedRangeInternal     = FeedRangeEPK.ForFullRange();
                feedRangeContinuation = new FeedRangeCompositeContinuation(
                    string.Empty,
                    feedRangeInternal,
                    new List <Documents.Routing.Range <string> >()
                {
                    new Documents.Routing.Range <string>(
                        Documents.Routing.PartitionKeyInternal.MinimumInclusiveEffectivePartitionKey,
                        Documents.Routing.PartitionKeyInternal.MaximumExclusiveEffectivePartitionKey,
                        isMinInclusive: true,
                        isMaxInclusive: false)
                },
                    continuation);
                return(new FeedRangeIteratorCore(containerCore, feedRangeContinuation, options, resourceType, queryDefinition));
            }

            feedRangeInternal = feedRangeInternal ?? FeedRangeEPK.ForFullRange();
            return(new FeedRangeIteratorCore(containerCore, feedRangeInternal, options, resourceType, queryDefinition));
        }
Пример #2
0
        public static ChangeFeedIteratorCore Create(
            ContainerInternal container,
            FeedRangeInternal feedRangeInternal,
            string continuation,
            ChangeFeedRequestOptions changeFeedRequestOptions)
        {
            if (!string.IsNullOrEmpty(continuation))
            {
                if (FeedRangeContinuation.TryParse(continuation, out FeedRangeContinuation feedRangeContinuation))
                {
                    return(new ChangeFeedIteratorCore(container, feedRangeContinuation, changeFeedRequestOptions));
                }
                else
                {
                    throw new ArgumentException(string.Format(ClientResources.FeedToken_UnknownFormat, continuation));
                }
            }

            feedRangeInternal = feedRangeInternal ?? FeedRangeEPK.ForFullRange();
            return(new ChangeFeedIteratorCore(container, feedRangeInternal, changeFeedRequestOptions));
        }