Пример #1
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 ODataReaderCoreAsync(
     ODataInputContext inputContext,
     bool readingFeed,
     IODataReaderWriterListener listener)
     : base(inputContext, readingFeed, listener)
 {
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="inputContext">The input to read from.</param>
 /// <param name="expectedItemTypeReference">The expected type reference for the items in the collection.</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 ODataCollectionReaderCoreAsync(
     ODataInputContext inputContext,
     IEdmTypeReference expectedItemTypeReference,
     IODataReaderWriterListener listener)
     : base(inputContext, expectedItemTypeReference, listener)
 {
 }
Пример #3
0
 private Task <T> ReadFromInputAsync <T>(Func <ODataInputContext, Task <T> > readFunc, params ODataPayloadKind[] payloadKinds) where T : class
 {
     this.ProcessContentType(payloadKinds);
     return(ODataInputContext.CreateInputContextAsync(this.format, this.readerPayloadKind, this.message, this.encoding, this.settings, this.version, this.readingResponse, this.model, this.urlResolver).FollowOnSuccessWithTask <ODataInputContext, T>(delegate(Task <ODataInputContext> createInputContextTask) {
         this.inputContext = createInputContextTask.Result;
         return readFunc(this.inputContext);
     }));
 }
Пример #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input to read from.</param>
        /// <param name="functionImport">The function import whose parameters are being read.</param>
        protected ODataParameterReaderCore(
            ODataInputContext inputContext,
            IEdmFunctionImport functionImport)
        {
            this.inputContext   = inputContext;
            this.functionImport = functionImport;

            this.EnterScope(ODataParameterReaderState.Start, null, null);
        }
 protected ODataCollectionReaderCore(ODataInputContext inputContext, IEdmTypeReference expectedItemTypeReference, IODataReaderWriterListener listener)
 {
     this.inputContext = inputContext;
     this.expectedItemTypeReference = expectedItemTypeReference;
     if (this.expectedItemTypeReference == null)
     {
         this.collectionValidator = new CollectionWithoutExpectedTypeValidator(null);
     }
     this.listener = listener;
     this.EnterScope(ODataCollectionReaderState.Start, null);
 }
Пример #6
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));
 }
Пример #7
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input to read from.</param>
        /// <param name="expectedItemTypeReference">The expected type reference for the items in the collection.</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 ODataCollectionReaderCore(
            ODataInputContext inputContext,
            IEdmTypeReference expectedItemTypeReference,
            IODataReaderWriterListener listener)
        {
            this.inputContext = inputContext;
            this.expectedItemTypeReference = expectedItemTypeReference;

            if (this.expectedItemTypeReference == null)
            {
                // NOTE: collections cannot specify a type name for the collection itself, so always passing null.
                this.collectionValidator = new CollectionWithoutExpectedTypeValidator(/*expectedItemTypeName*/ null);
            }

            this.listener = listener;
            this.EnterScope(ODataCollectionReaderState.Start, null);
        }
Пример #8
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();
            }
        }
Пример #9
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));
        }
Пример #10
0
 private void Dispose(bool disposing)
 {
     this.isDisposed = true;
     if (disposing)
     {
         try
         {
             if (this.inputContext != null)
             {
                 this.inputContext.Dispose();
             }
         }
         finally
         {
             this.inputContext = null;
         }
         if (!this.settings.DisableMessageStreamDisposal && (this.message.BufferingReadStream != null))
         {
             this.message.BufferingReadStream.Dispose();
         }
     }
 }
Пример #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="inputContext">The input to read from.</param>
 /// <param name="functionImport">The function import whose parameters are being read.</param>
 protected ODataParameterReaderCoreAsync(
     ODataInputContext inputContext,
     IEdmFunctionImport functionImport)
     : base(inputContext, functionImport)
 {
 }
Пример #12
0
 protected ODataDeserializer(ODataInputContext inputContext)
 {
     this.inputContext = inputContext;
 }
Пример #13
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input context to read from.</param>
        protected ODataDeserializer(ODataInputContext inputContext)
        {
            Debug.Assert(inputContext != null, "inputContext != null");

            this.inputContext = inputContext;
        }
Пример #14
0
 protected ODataDeserializer(ODataInputContext inputContext)
 {
     this.inputContext = inputContext;
 }
Пример #15
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="inputContext">The input context to read from.</param>
        protected ODataDeserializer(ODataInputContext inputContext)
        {
            Debug.Assert(inputContext != null, "inputContext != null");

            this.inputContext = inputContext;
        }
Пример #16
0
 private T ReadFromInput <T>(Func <ODataInputContext, T> readFunc, params ODataPayloadKind[] payloadKinds) where T : class
 {
     this.ProcessContentType(payloadKinds);
     this.inputContext = ODataInputContext.CreateInputContext(this.format, this.readerPayloadKind, this.message, this.encoding, this.settings, this.version, this.readingResponse, this.model, this.urlResolver);
     return(readFunc(this.inputContext));
 }