Exemple #1
0
        private DocumentFeedResponse <T> GetFeedResponse <T>(DocumentServiceResponse response)
        {
            long            responseLengthBytes = response.ResponseBody.CanSeek ? response.ResponseBody.Length : 0;
            IEnumerable <T> responseFeed        = response.GetQueryResponse <T>(this.ResourceType, this.getLazyFeedResponse, out int itemCount);

            return(new DocumentFeedResponse <T>(responseFeed, itemCount, response.Headers, response.RequestStats, responseLengthBytes));
        }
Exemple #2
0
 private async Task <DocumentFeedResponse <TResult> > ReadDocumentChangeFeedPrivateAsync <TResult>(string link, IDocumentClientRetryPolicy retryPolicyInstance, CancellationToken cancellationToken)
 {
     using (DocumentServiceResponse response = await this.GetFeedResponseAsync(link, this.resourceType, retryPolicyInstance, cancellationToken))
     {
         this.lastStatusCode  = response.StatusCode;
         this.nextIfNoneMatch = response.Headers[HttpConstants.HttpHeaders.ETag];
         if (response.ResponseBody != null && response.ResponseBody.Length > 0)
         {
             long responseLengthInBytes = response.ResponseBody.Length;
             int  itemCount             = 0;
             IEnumerable <dynamic>          feedResource = response.GetQueryResponse(typeof(TResource), out itemCount);
             DocumentFeedResponse <dynamic> feedResponse = new DocumentFeedResponse <dynamic>(
                 feedResource,
                 itemCount,
                 response.Headers,
                 true,
                 null,
                 response.RequestStats,
                 responseLengthBytes: responseLengthInBytes);
             return((dynamic)feedResponse);
         }
         else
         {
             return(new DocumentFeedResponse <TResult>(
                        Enumerable.Empty <TResult>(),
                        0,
                        response.Headers,
                        true,
                        null,
                        response.RequestStats));
         }
     }
 }
        private FeedResponse <dynamic> GetFeedResponse(DocumentServiceResponse response)
        {
            int itemCount = 0;

            long responseLengthBytes = response.ResponseBody.CanSeek ? response.ResponseBody.Length : 0;

            IEnumerable <dynamic> responseFeed = response.GetQueryResponse(this.resourceType, out itemCount);

            return(new FeedResponse <dynamic>(responseFeed, itemCount, response.Headers, response.RequestStats, responseLengthBytes));
        }