/// <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 ODataBatchOperationResponseMessage CreateOperationResponseMessageImplementation() { this.operationState = OperationState.MessageCreated; string responseLine = this.batchStream.ReadFirstNonEmptyLine(); int statusCode = this.ParseResponseLine(responseLine); // Read all headers and create the response message ODataBatchOperationHeaders headers = this.batchStream.ReadHeaders(); if (this.batchStream.ChangeSetBoundary != null) { if (this.allowLegacyContentIdBehaviour) { // Add a potential Content-ID header to the URL resolver so that it will be available // to subsequent operations. string contentId; if (this.contentIdToAddOnNextRead == null && headers.TryGetValue(ODataConstants.ContentIdHeader, out contentId)) { if (contentId != null && this.urlResolver.ContainsContentId(contentId)) { throw new ODataException(Strings.ODataBatchReader_DuplicateContentIDsNotAllowed(contentId)); } this.contentIdToAddOnNextRead = contentId; } } } // In responses we don't need to use our batch URL resolver, since there are no cross referencing URLs // so use the URL resolver from the batch message instead. ODataBatchOperationResponseMessage responseMessage = ODataBatchOperationResponseMessage.CreateReadMessage( this.batchStream, statusCode, headers, this.contentIdToAddOnNextRead, /*operationListener*/ this, this.urlResolver.BatchMessageUrlResolver); //// NOTE: Content-IDs for cross referencing are only supported in request messages; in responses //// we allow a Content-ID header but don't process it (i.e., don't add the content ID to the URL resolver). return(responseMessage); }