private ODataBatchOperationRequestMessage CreateOperationRequestMessageImplementation() { string str2; Uri uri; string str3; this.operationState = OperationState.MessageCreated; string requestLine = this.batchStream.ReadLine(); while (requestLine.Length == 0) { requestLine = this.batchStream.ReadLine(); } this.ParseRequestLine(requestLine, out str2, out uri); ODataBatchOperationHeaders headers = this.batchStream.ReadHeaders(); ODataBatchOperationRequestMessage message = ODataBatchOperationRequestMessage.CreateReadMessage(this.batchStream, str2, uri, headers, this, this.urlResolver); if (headers.TryGetValue("Content-ID", out str3)) { if ((str3 != null) && this.urlResolver.ContainsContentId(str3)) { throw new ODataException(Strings.ODataBatchReader_DuplicateContentIDsNotAllowed(str3)); } this.contentIdToAddOnNextRead = str3; } return(message); }
/// <summary> /// Returns the cached <see cref="ODataBatchOperationRequestMessage"/> for reading the content of an operation /// in a batch request. /// </summary> /// <returns>The message that can be used to read the content of the batch request operation from.</returns> private ODataBatchOperationRequestMessage CreateOperationRequestMessageImplementation() { this.operationState = OperationState.MessageCreated; // Read and parse the request line (skip all empty lines) string requestLine = this.batchStream.ReadLine(); while (requestLine.Length == 0) { requestLine = this.batchStream.ReadLine(); } string httpMethod; Uri requestUri; this.ParseRequestLine(requestLine, out httpMethod, out requestUri); // Read all headers and create the request message ODataBatchOperationHeaders headers = this.batchStream.ReadHeaders(); ODataBatchOperationRequestMessage requestMessage = ODataBatchOperationRequestMessage.CreateReadMessage( this.batchStream, httpMethod, requestUri, headers, /*operationListener*/ this, this.urlResolver); // Add a potential Content-ID header to the URL resolver so that it will be available // to subsequent operations. string contentId; if (headers.TryGetValue(ODataConstants.ContentIdHeader, out contentId)) { Debug.Assert(this.contentIdToAddOnNextRead == null, "Must not have a content ID to be added to a part."); if (contentId != null && this.urlResolver.ContainsContentId(contentId)) { throw new ODataException(Strings.ODataBatchReader_DuplicateContentIDsNotAllowed(contentId)); } this.contentIdToAddOnNextRead = contentId; } return(requestMessage); }