コード例 #1
0
        internal static ReadFeedResponse <TInput> CreateResponse <TInput>(
            Headers responseMessageHeaders,
            Stream stream,
            CosmosSerializer jsonSerializer,
            bool hasMoreResults)
        {
            using (stream)
            {
                CosmosFeedResponseUtil <TInput> response         = jsonSerializer.FromStream <CosmosFeedResponseUtil <TInput> >(stream);
                IEnumerable <TInput>            resources        = response.Data;
                ReadFeedResponse <TInput>       readFeedResponse = new ReadFeedResponse <TInput>(
                    resource: resources,
                    responseMessageHeaders: responseMessageHeaders,
                    hasMoreResults: hasMoreResults);

                return(readFeedResponse);
            }
        }
コード例 #2
0
        internal static ReadFeedResponse <TInput> CreateResponse <TInput>(
            ResponseMessage responseMessage,
            CosmosSerializer jsonSerializer)
        {
            using (responseMessage)
            {
                ICollection <TInput> resources = default(ICollection <TInput>);
                if (responseMessage.Content != null)
                {
                    CosmosFeedResponseUtil <TInput> response = jsonSerializer.FromStream <CosmosFeedResponseUtil <TInput> >(responseMessage.Content);
                    resources = response.Data;
                }

                ReadFeedResponse <TInput> readFeedResponse = new ReadFeedResponse <TInput>(
                    resource: resources,
                    responseMessageHeaders: responseMessage.Headers);

                return(readFeedResponse);
            }
        }