/// <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) { }
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); })); }
/// <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); }
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)); }
/// <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); }
/// <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(); } }
/// <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)); }
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(); } } }
/// <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) { }
protected ODataDeserializer(ODataInputContext inputContext) { this.inputContext = inputContext; }
/// <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; }
protected ODataDeserializer(ODataInputContext inputContext) { this.inputContext = inputContext; }
/// <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; }
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)); }