Ejemplo n.º 1
0
 /// <summary>
 /// Writes the start boundary for an operation. This is either the batch or the changeset boundary.
 /// </summary>
 private void WriteStartBoundaryForOperation()
 {
     if (this.changeSetBoundary == null)
     {
         ODataBatchWriterUtils.WriteStartBoundary(this.batchWriter, this.batchBoundary);
         this.batchStartBoundaryWritten = true;
     }
     else
     {
         ODataBatchWriterUtils.WriteStartBoundary(this.batchWriter, this.changeSetBoundary);
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Starts a new changeset; can only be called after WriteStartBatch and if no other active operation or changeset exists.
        /// </summary>
        public void WriteStartChangeset()
        {
            this.ValidateWriterReady();

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

            // important to do this first since it will set up the change set boundary.
            this.SetState(BatchWriterState.ChangeSetStarted);
            Debug.Assert(this.changeSetBoundary != null, "this.changeSetBoundary != null");

            // reset the size of the current changeset and increase the size of the batch
            this.ResetChangeSetSize();
            this.InterceptException(this.IncreaseBatchSize);

            // write the boundary string
            ODataBatchWriterUtils.WriteStartBoundary(this.batchWriter, this.batchBoundary);
            this.batchStartBoundaryWritten = true;

            // write the change set headers
            ODataBatchWriterUtils.WriteChangeSetPreamble(this.batchWriter, this.changeSetBoundary);
        }