Esempio n. 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input context to read the content from.</param>
        /// <param name="batchBoundary">The boundary string for the batch structure itself.</param>
        /// <param name="batchEncoding">The encoding to use to read from the batch stream.</param>
        /// <param name="synchronous">true if the reader is created for synchronous operation; false for asynchronous.</param>
        internal ODataBatchReader(ODataRawInputContext inputContext, string batchBoundary, Encoding batchEncoding, bool synchronous)
        {
            Debug.Assert(inputContext != null, "inputContext != null");
            Debug.Assert(!string.IsNullOrEmpty(batchBoundary), "!string.IsNullOrEmpty(batchBoundary)");

            this.inputContext = inputContext;
            this.synchronous  = synchronous;
            this.urlResolver  = new ODataBatchUrlResolver(inputContext.UrlResolver);
            this.batchStream  = new ODataBatchReaderStream(inputContext, batchBoundary, batchEncoding);
            this.allowLegacyContentIdBehaviour = true;
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="rawOutputContext">The output context to write to.</param>
        /// <param name="batchBoundary">The boundary string for the batch structure itself.</param>
        internal ODataBatchWriter(ODataRawOutputContext rawOutputContext, string batchBoundary)
        {
            Debug.Assert(rawOutputContext != null, "rawOutputContext != null");
            Debug.Assert(
                rawOutputContext.MessageWriterSettings.PayloadBaseUri == null || rawOutputContext.MessageWriterSettings.PayloadBaseUri.IsAbsoluteUri,
                "We should have validated that PayloadBaseUri is absolute.");

            ExceptionUtils.CheckArgumentNotNull(batchBoundary, "batchBoundary");

            this.rawOutputContext = rawOutputContext;
            this.batchBoundary = batchBoundary;
            this.urlResolver = new ODataBatchUrlResolver(rawOutputContext.UrlResolver);
            this.rawOutputContext.InitializeRawValueWriter();
        }