示例#1
0
        /// <summary>
        /// Ends an active changeset; this can only be called after WriteStartChangeset and only once for each changeset.
        /// </summary>
        public void WriteEndChangeset()
        {
            this.ValidateWriterReady();

            // write pending message data (headers, response line) for a previously unclosed message/request
            this.WritePendingMessageData(true);

            // change the state first so we validate the change set boundary before attempting to write it.
            string currentChangeSetBoundary = this.changeSetBoundary;

            this.SetState(BatchWriterState.ChangeSetCompleted);

            // write the end boundary for the change set
            ODataBatchWriterUtils.WriteEndBoundary(this.batchWriter, currentChangeSetBoundary);
        }
示例#2
0
        /// <summary>
        /// Ends a batch; can only be called after WriteStartBatch has been called and if no other active changeset or operation exist.
        /// </summary>
        public void WriteEndBatch()
        {
            this.ValidateWriterReady();

            // write the start boundary for the batch if not written
            if (!this.batchStartBoundaryWritten)
            {
                Debug.Assert(this.CurrentOperationMessage == null, "If not batch boundary was written we must not have an active message.");
                ODataBatchWriterUtils.WriteStartBoundary(this.batchWriter, this.batchBoundary);
            }

            // write pending message data (headers, response line) for a previously unclosed message/request
            this.WritePendingMessageData(true);

            this.SetState(BatchWriterState.BatchCompleted);

            // write the end boundary for the batch
            ODataBatchWriterUtils.WriteEndBoundary(this.batchWriter, this.batchBoundary);
        }