Example #1
0
 protected ODataWriterCore(ODataOutputContext outputContext, bool writingFeed)
 {
     this.outputContext = outputContext;
     this.writingFeed = writingFeed;
     if (this.writingFeed && this.outputContext.Model.IsUserModel())
     {
         this.feedValidator = new FeedWithoutExpectedTypeValidator();
     }
     this.scopes.Push(new Scope(WriterState.Start, null, false));
 }
Example #2
0
 protected ODataWriterCore(ODataOutputContext outputContext, bool writingFeed)
 {
     this.outputContext = outputContext;
     this.writingFeed   = writingFeed;
     if (this.writingFeed && this.outputContext.Model.IsUserModel())
     {
         this.feedValidator = new FeedWithoutExpectedTypeValidator();
     }
     this.scopes.Push(new Scope(WriterState.Start, null, false));
 }
Example #3
0
 protected ODataReaderCore(ODataInputContext inputContext, IEdmEntityType expectedEntityType, bool readingFeed, IODataReaderWriterListener listener)
 {
     this.inputContext      = inputContext;
     this.readingFeed       = readingFeed;
     this.listener          = listener;
     this.currentEntryDepth = 0;
     if (this.readingFeed && this.inputContext.Model.IsUserModel())
     {
         this.feedValidator = new FeedWithoutExpectedTypeValidator();
     }
     this.EnterScope(new Scope(ODataReaderState.Start, null, expectedEntityType));
 }
Example #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="outputContext">The output context to write to.</param>
        /// <param name="writingFeed">True if the writer is created for writing a feed; false when it is created for writing an entry.</param>
        protected ODataWriterCore(ODataOutputContext outputContext, bool writingFeed)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(outputContext != null, "outputContext != null");

            this.outputContext = outputContext;
            this.writingFeed = writingFeed;

            // create a collection validator when writing a top-level feed and a user model is present
            if (this.writingFeed && this.outputContext.Model.IsUserModel())
            {
                this.feedValidator = new FeedWithoutExpectedTypeValidator();
            }

            this.scopes.Push(new Scope(WriterState.Start, null, false));
        }
Example #5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input to read the payload from.</param>
        /// <param name="readingFeed">true if the reader is created for reading a feed; false when it is created for reading an entry.</param>
        /// <param name="listener">If not null, the reader will notify the implementer of the interface of relevant state changes in the reader.</param>
        protected ODataReaderCore(
            ODataInputContext inputContext,
            bool readingFeed,
            IODataReaderWriterListener listener)
        {
            Debug.Assert(inputContext != null, "inputContext != null");

            this.inputContext      = inputContext;
            this.readingFeed       = readingFeed;
            this.listener          = listener;
            this.currentEntryDepth = 0;

            // create a collection validator when reading a top-level feed and a user model is present
            if (this.readingFeed && this.inputContext.Model.IsUserModel())
            {
                this.feedValidator = new FeedWithoutExpectedTypeValidator();
            }
        }
Example #6
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input to read the payload from.</param>
        /// <param name="expectedEntityType">The expected entity type for the entry to be read (in case of entry reader) or entries in the feed to be read (in case of feed reader).</param>
        /// <param name="readingFeed">true if the reader is created for reading a feed; false when it is created for reading an entry.</param>
        /// <param name="listener">If not null, the reader will notify the implementer of the interface of relevant state changes in the reader.</param>
        protected ODataReaderCore(ODataInputContext inputContext, IEdmEntityType expectedEntityType, bool readingFeed, IODataReaderWriterListener listener)
        {
            Debug.Assert(inputContext != null, "inputContext != null");
            Debug.Assert(
                expectedEntityType == null || inputContext.Model.IsUserModel(),
                "If the expected type is specified we need model as well. We should have verified that by now.");

            this.inputContext      = inputContext;
            this.readingFeed       = readingFeed;
            this.listener          = listener;
            this.currentEntryDepth = 0;

            // create a collection validator when reading a top-level feed and a user model is present
            if (this.readingFeed && this.inputContext.Model.IsUserModel())
            {
                this.feedValidator = new FeedWithoutExpectedTypeValidator();
            }

            this.EnterScope(new Scope(ODataReaderState.Start, null, expectedEntityType));
        }