예제 #1
0
        public static LogEntry For(QueryNextRequest request)
        {
            LogEntry entry = new LogEntry("QueryNextRequest");

            entry.Add("RequestHeader", For(request.RequestHeader));
            entry.Add("ReleaseContinuationPoint", For(request.ReleaseContinuationPoint));
            return(entry);
        }
예제 #2
0
        public async Task QueryNextAsync()
        {
            var response = new QueryNextResponse();
            var request  = new QueryNextRequest();
            var channel  = new TestRequestChannel(response);

            var ret = await channel.QueryNextAsync(request);

            ret
            .Should().BeSameAs(response);

            channel.Request
            .Should().BeSameAs(request);
        }
예제 #3
0
        /// <summary>
        /// Requests the next set of Query responses, when the information is too large to be sent in a single response.
        /// </summary>
        /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param>
        /// <param name="request">A <see cref="QueryNextRequest"/>.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="QueryNextResponse"/>.</returns>
        public static async Task <QueryNextResponse> QueryNextAsync(this IRequestChannel channel, QueryNextRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            return((QueryNextResponse)await channel.RequestAsync(request).ConfigureAwait(false));
        }
예제 #4
0
        /// <summary>
        /// Begins an asynchronous invocation of the QueryNext service.
        /// </summary>
        public IAsyncResult BeginQueryNext(
            RequestHeader requestHeader,
            bool          releaseContinuationPoint,
            byte[]        continuationPoint,
            AsyncCallback callback,
            object        asyncState)
        {
            QueryNextRequest request = new QueryNextRequest();

            request.RequestHeader            = requestHeader;
            request.ReleaseContinuationPoint = releaseContinuationPoint;
            request.ContinuationPoint        = continuationPoint;

            UpdateRequestHeader(request, requestHeader == null, "QueryNext");

            if (UseTransportChannel)
            {
                return TransportChannel.BeginSendRequest(request, callback, asyncState);
            }

            return InnerChannel.BeginQueryNext(new QueryNextMessage(request), callback, asyncState);
        }
예제 #5
0
        /// <summary>
        /// Invokes the QueryNext service.
        /// </summary>
        public virtual ResponseHeader QueryNext(
            RequestHeader              requestHeader,
            bool                       releaseContinuationPoint,
            byte[]                     continuationPoint,
            out QueryDataSetCollection queryDataSets,
            out byte[]                 revisedContinuationPoint)
        {
            QueryNextRequest request = new QueryNextRequest();
            QueryNextResponse response = null;

            request.RequestHeader            = requestHeader;
            request.ReleaseContinuationPoint = releaseContinuationPoint;
            request.ContinuationPoint        = continuationPoint;

            UpdateRequestHeader(request, requestHeader == null, "QueryNext");

            try
            {
                if (UseTransportChannel)
                {
                    IServiceResponse genericResponse = TransportChannel.SendRequest(request);

                    if (genericResponse == null)
                    {
                        throw new ServiceResultException(StatusCodes.BadUnknownResponse);
                    }

                    ValidateResponse(genericResponse.ResponseHeader);
                    response = (QueryNextResponse)genericResponse;
                }
                else
                {
                    QueryNextResponseMessage responseMessage = InnerChannel.QueryNext(new QueryNextMessage(request));

                    if (responseMessage == null || responseMessage.QueryNextResponse == null)
                    {
                        throw new ServiceResultException(StatusCodes.BadUnknownResponse);
                    }

                    response = responseMessage.QueryNextResponse;
                    ValidateResponse(response.ResponseHeader);
                }

                queryDataSets            = response.QueryDataSets;
                revisedContinuationPoint = response.RevisedContinuationPoint;
            }
            finally
            {
                RequestCompleted(request, response, "QueryNext");
            }

            return response.ResponseHeader;
        }
예제 #6
0
        /// <summary>
        /// Requests the next set of Query responses, when the information is too large to be sent in a single response.
        /// </summary>
        /// <param name="channel">A instance of <see cref="IRequestChannel"/>.</param>
        /// <param name="request">A <see cref="QueryNextRequest"/>.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation that returns a <see cref="QueryNextResponse"/>.</returns>
        public static async Task <QueryNextResponse> QueryNextAsync(this IRequestChannel channel, QueryNextRequest request, CancellationToken token = default)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            return((QueryNextResponse)await channel.RequestAsync(request, token).ConfigureAwait(false));
        }
예제 #7
0
 /// <summary>
 /// Initializes the message with the body.
 /// </summary>
 public QueryNextMessage(QueryNextRequest QueryNextRequest)
 {
     this.QueryNextRequest = QueryNextRequest;
 }