/// <summary> /// Asynchronously starts a new changeset - implementation of the actual functionality. /// </summary> /// <param name="changesetId">The value for changeset boundary for multipart batch.</param> /// <returns>A task that represents the asynchronous write operation.</returns> protected override async Task WriteStartChangesetImplementationAsync(string changesetId) { Debug.Assert(changesetId != null, "changesetId != null"); // Write pending message data (headers, response line) for a previously unclosed message/request await this.WritePendingMessageDataAsync(true) .ConfigureAwait(false); this.SetState(BatchWriterState.ChangesetStarted); Debug.Assert(this.changeSetBoundary == null, "this.changeSetBoundary == null"); this.changeSetBoundary = ODataMultipartMixedBatchWriterUtils.CreateChangeSetBoundary(this.RawOutputContext.WritingResponse, changesetId); // Write the boundary string await ODataMultipartMixedBatchWriterUtils.WriteStartBoundaryAsync( this.RawOutputContext.TextWriter, this.batchBoundary, !this.batchStartBoundaryWritten).ConfigureAwait(false); this.batchStartBoundaryWritten = true; // Write the changeset headers await ODataMultipartMixedBatchWriterUtils.WriteChangesetPreambleAsync( this.RawOutputContext.TextWriter, this.changeSetBoundary).ConfigureAwait(false); this.changesetStartBoundaryWritten = false; // Set state to track dependsOnIds. this.dependsOnIdsTracker.ChangeSetStarted(); }
/// <summary> /// Asynchronously writes the start boundary for an operation. This is either the batch or the changeset boundary. /// </summary> /// <returns>A task that represents the asynchronous write operation.</returns> private async Task WriteStartBoundaryForOperationAsync() { if (this.changeSetBoundary == null) { await ODataMultipartMixedBatchWriterUtils.WriteStartBoundaryAsync( this.RawOutputContext.TextWriter, this.batchBoundary, !this.batchStartBoundaryWritten).ConfigureAwait(false); this.batchStartBoundaryWritten = true; } else { await ODataMultipartMixedBatchWriterUtils.WriteStartBoundaryAsync( this.RawOutputContext.TextWriter, this.changeSetBoundary, !this.changesetStartBoundaryWritten).ConfigureAwait(false); this.changesetStartBoundaryWritten = true; } }