/// <summary> /// Creates an <see cref="ODataBatchOperationRequestMessage"/> for writing an operation of a batch request /// - implementation of the actual functionality. /// </summary> /// <param name="method">The Http method to be used for this request operation.</param> /// <param name="uri">The Uri to be used for this request operation.</param> /// <param name="contentId">The Content-ID value to write in ChangeSet head.</param> /// <param name="payloadUriOption"> /// The format of operation Request-URI, which could be AbsoluteUri, AbsoluteResourcePathAndHost, or RelativeResourcePath.</param> /// <param name="dependsOnIds">The prerequisite request ids of this request. By default its value should be null for Multipart/Mixed /// format and the dependsOnIds implicitly derived per the protocol will be used; Otherwise, non-null will be used as override after /// validation.</param> /// <returns>The message that can be used to write the request operation.</returns> protected override ODataBatchOperationRequestMessage CreateOperationRequestMessageImplementation( string method, Uri uri, string contentId, BatchPayloadUriOption payloadUriOption, IEnumerable <string> dependsOnIds) { // write pending message data (headers, response line) for a previously unclosed message/request this.WritePendingMessageData(true); // create the new request operation // For Multipart batch format, validate dependsOnIds if it is user explicit input, otherwise skip validation // when it is implicitly derived per protocol. ODataBatchOperationRequestMessage operationRequestMessage = BuildOperationRequestMessage( this.RawOutputContext.OutputStream, method, uri, contentId, this.changeSetBoundary, dependsOnIds); this.SetState(BatchWriterState.OperationCreated); // write the operation's start boundary string this.WriteStartBoundaryForOperation(); if (contentId != null) { this.dependsOnIdsTracker.AddDependsOnId(contentId); } // write the headers and request line ODataMultipartMixedBatchWriterUtils.WriteRequestPreamble(this.RawOutputContext.TextWriter, method, uri, this.RawOutputContext.MessageWriterSettings.BaseUri, changeSetBoundary != null, contentId, payloadUriOption); return(operationRequestMessage); }
/// <summary> /// Creates an <see cref="ODataBatchOperationRequestMessage"/> for writing an operation of a batch request /// - implementation of the actual functionality. /// </summary> /// <param name="method">The Http method to be used for this request operation.</param> /// <param name="uri">The Uri to be used for this request operation.</param> /// <param name="contentId">The Content-ID value to write in ChangeSet head.</param> /// <param name="payloadUriOption"> /// The format of operation Request-URI, which could be AbsoluteUri, AbsoluteResourcePathAndHost, or RelativeResourcePath.</param> /// <param name="dependsOnIds">The prerequisite request ids of this request.</param> /// <returns>The message that can be used to write the request operation.</returns> protected override ODataBatchOperationRequestMessage CreateOperationRequestMessageImplementation( string method, Uri uri, string contentId, BatchPayloadUriOption payloadUriOption, IEnumerable<string> dependsOnIds) { // write pending message data (headers, response line) for a previously unclosed message/request this.WritePendingMessageData(true); // create the new request operation ODataBatchOperationRequestMessage operationRequestMessage = BuildOperationRequestMessage( this.RawOutputContext.OutputStream, method, uri, contentId, /*groupId*/null, dependsOnIds, ODataFormat.Batch); this.SetState(BatchWriterState.OperationCreated); // write the operation's start boundary string this.WriteStartBoundaryForOperation(); // write the headers and request line ODataMultipartMixedBatchWriterUtils.WriteRequestPreamble(this.RawOutputContext.TextWriter, method, uri, this.RawOutputContext.MessageWriterSettings.BaseUri, changeSetBoundary != null, contentId, payloadUriOption); return operationRequestMessage; }