/// <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) { }
/// <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 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="outputContext">The output context to write to.</param> /// <param name="navigationSource">The navigation source we are going to write entities for.</param> /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param> /// <param name="writingFeed">True if the writer is created for writing a feed; false when it is created for writing an entry.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataWriterCore( ODataOutputContext outputContext, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool writingFeed, IODataReaderWriterListener listener = null) { 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(); } if (navigationSource != null && entityType == null) { entityType = this.outputContext.EdmTypeResolver.GetElementType(navigationSource); } ODataUri odataUri = outputContext.MessageWriterSettings.ODataUri.Clone(); // Remove key for top level entry if (!writingFeed && odataUri != null && odataUri.Path != null) { odataUri.Path = odataUri.Path.TrimEndingKeySegment(); } this.listener = listener; this.scopes.Push(new Scope(WriterState.Start, /*item*/null, navigationSource, entityType, /*skipWriting*/false, outputContext.MessageWriterSettings.SelectedProperties, odataUri)); }
/// <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) { }
/// <summary> /// Constructor. /// </summary> /// <param name="inputContext">The input to read the payload from.</param> /// <param name="readingResourceSet">true if the reader is created for reading a resource set; false when it is created for reading a resource.</param> /// <param name="readingDelta">true if the reader is created for reading expanded navigation property in delta response; false otherwise.</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 readingResourceSet, bool readingDelta, IODataReaderWriterListener listener) : base(inputContext, readingResourceSet, readingDelta, listener) { }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); }
internal ODataJsonCollectionReader(ODataJsonInputContext jsonInputContext, IEdmTypeReference expectedItemTypeReference, IODataReaderWriterListener listener) : base(jsonInputContext, expectedItemTypeReference, listener) { this.jsonInputContext = jsonInputContext; this.jsonCollectionDeserializer = new ODataJsonCollectionDeserializer(jsonInputContext); if (!jsonInputContext.Model.IsUserModel()) { throw new ODataException(Microsoft.Data.OData.Strings.ODataJsonCollectionReader_ParsingWithoutMetadata); } }
internal ODataJsonReader(ODataJsonInputContext jsonInputContext, IEdmEntityType expectedEntityType, bool readingFeed, IODataReaderWriterListener listener) : base(jsonInputContext, expectedEntityType, readingFeed, listener) { this.jsonInputContext = jsonInputContext; this.jsonEntryAndFeedDeserializer = new ODataJsonEntryAndFeedDeserializer(jsonInputContext); if (!this.jsonInputContext.Model.IsUserModel()) { throw new ODataException(Microsoft.Data.OData.Strings.ODataJsonReader_ParsingWithoutMetadata); } }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonOutputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonCollectionWriter(ODataJsonOutputContext jsonOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(jsonOutputContext, expectedItemType, listener) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(jsonOutputContext != null, "jsonOutputContext != null"); this.jsonOutputContext = jsonOutputContext; this.jsonCollectionSerializer = new ODataJsonCollectionSerializer(this.jsonOutputContext); }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); }
/// <summary> /// Constructor for creating a collection writer to use when writing parameter payloads. /// </summary> /// <param name="jsonLightOutputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonLightCollectionWriter(ODataJsonLightOutputContext jsonLightOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(jsonLightOutputContext, expectedItemType, listener) { Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null"); Debug.Assert(!jsonLightOutputContext.WritingResponse, "The collection writer constructor for parameter payloads must only be used for writing requests."); this.jsonLightOutputContext = jsonLightOutputContext; this.jsonLightCollectionSerializer = new ODataJsonLightCollectionSerializer(this.jsonLightOutputContext, /*writingTopLevelCollection*/false); }
protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); if (this.expectedItemType == null) { this.collectionValidator = new CollectionWithoutExpectedTypeValidator(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 ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); if (this.expectedItemType == null) { this.collectionValidator = new CollectionWithoutExpectedTypeValidator(null); } }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The input to read the payload from.</param> /// <param name="expectedItemTypeReference">The expected type 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> internal ODataJsonLightCollectionReader( ODataJsonLightInputContext jsonLightInputContext, IEdmTypeReference expectedItemTypeReference, IODataReaderWriterListener listener) : base(jsonLightInputContext, expectedItemTypeReference, listener) { Debug.Assert(jsonLightInputContext != null, "jsonLightInputContext != null"); this.jsonLightInputContext = jsonLightInputContext; this.jsonLightCollectionDeserializer = new ODataJsonLightCollectionDeserializer(jsonLightInputContext); }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The input to read the payload from.</param> /// <param name="expectedItemTypeReference">The expected type 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> internal ODataJsonLightCollectionReader( ODataJsonLightInputContext jsonLightInputContext, IEdmTypeReference expectedItemTypeReference, IODataReaderWriterListener listener) : base(jsonLightInputContext, expectedItemTypeReference, listener) { Debug.Assert(jsonLightInputContext != null, "jsonLightInputContext != null"); this.jsonLightInputContext = jsonLightInputContext; this.jsonLightCollectionDeserializer = new ODataJsonLightCollectionDeserializer(jsonLightInputContext); }
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="jsonInputContext">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 Json reader will notify the implementer of the interface of relevant state changes in the Json reader.</param> internal ODataJsonReader(ODataJsonInputContext jsonInputContext, IEdmEntityType expectedEntityType, bool readingFeed, IODataReaderWriterListener listener) : base(jsonInputContext, expectedEntityType, readingFeed, listener) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(jsonInputContext != null, "jsonInputContext != null"); this.jsonInputContext = jsonInputContext; this.jsonEntryAndFeedDeserializer = new ODataJsonEntryAndFeedDeserializer(jsonInputContext); if (!this.jsonInputContext.Model.IsUserModel()) { throw new ODataException(o.Strings.ODataJsonReader_ParsingWithoutMetadata); } }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); if (this.expectedItemType == null) { this.collectionValidator = new CollectionWithoutExpectedTypeValidator(/*expectedItemTypeName*/ null); } }
/// <summary> /// Constructor. /// </summary> /// <param name="outputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> protected ODataCollectionWriterCore(ODataOutputContext outputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(outputContext != null, "outputContext != null"); this.outputContext = outputContext; this.expectedItemType = expectedItemType; this.listener = listener; this.scopes.Push(new Scope(CollectionWriterState.Start, null)); if (this.expectedItemType == null) { this.collectionValidator = new CollectionWithoutExpectedTypeValidator(/*expectedItemTypeName*/ null); } }
/// <summary> /// Constructor. /// </summary> /// <param name="inputContext">The input to read the payload from.</param> /// <param name="readingResourceSet">true if the reader is created for reading a resource set; false when it is created for reading a resource.</param> /// <param name="readingDelta">true if the reader is created for reading expanded navigation property in delta response; false otherwise.</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 readingResourceSet, bool readingDelta, IODataReaderWriterListener listener) { Debug.Assert(inputContext != null, "inputContext != null"); this.inputContext = inputContext; this.readingResourceSet = readingResourceSet; this.readingDelta = readingDelta; this.listener = listener; this.currentResourceDepth = 0; this.Version = inputContext.MessageReaderSettings.Version; }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightOutputContext">The output context to write to.</param> /// <param name="navigationSource">The navigation source we are going to write entities for.</param> /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param> /// <param name="writingFeed">true if the writer is created for writing a feed; false when it is created for writing an entry.</param> /// <param name="writingParameter">true if the writer is created for writing a parameter; false otherwise.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonLightWriter( ODataJsonLightOutputContext jsonLightOutputContext, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool writingFeed, bool writingParameter = false, IODataReaderWriterListener listener = null) : base(jsonLightOutputContext, navigationSource, entityType, writingFeed, listener) { Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null"); this.jsonLightOutputContext = jsonLightOutputContext; this.jsonLightEntryAndFeedSerializer = new ODataJsonLightEntryAndFeedSerializer(this.jsonLightOutputContext); this.writingParameter = writingParameter; }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightOutputContext">The output context to write to.</param> /// <param name="navigationSource">The navigation source we are going to write entities for.</param> /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param> /// <param name="writingFeed">true if the writer is created for writing a feed; false when it is created for writing an entry.</param> /// <param name="writingParameter">true if the writer is created for writing a parameter; false otherwise.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonLightWriter( ODataJsonLightOutputContext jsonLightOutputContext, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool writingFeed, bool writingParameter = false, IODataReaderWriterListener listener = null) : base(jsonLightOutputContext, navigationSource, entityType, writingFeed, listener) { Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null"); this.jsonLightOutputContext = jsonLightOutputContext; this.jsonLightEntryAndFeedSerializer = new ODataJsonLightEntryAndFeedSerializer(this.jsonLightOutputContext); this.writingParameter = writingParameter; }
/// <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="verboseJsonInputContext">The input to read the payload from.</param> /// <param name="expectedItemTypeReference">The expected type 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> internal ODataVerboseJsonCollectionReader( ODataVerboseJsonInputContext verboseJsonInputContext, IEdmTypeReference expectedItemTypeReference, IODataReaderWriterListener listener) : base(verboseJsonInputContext, expectedItemTypeReference, listener) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(verboseJsonInputContext != null, "verboseJsonInputContext != null"); this.verboseJsonInputContext = verboseJsonInputContext; this.verboseJsonCollectionDeserializer = new ODataVerboseJsonCollectionDeserializer(verboseJsonInputContext); if (!verboseJsonInputContext.Model.IsUserModel()) { throw new ODataException(ODataErrorStrings.ODataJsonCollectionReader_ParsingWithoutMetadata); } }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightOutputContext">The output context to write to.</param> /// <param name="navigationSource">The navigation source we are going to write entities for.</param> /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param> /// <param name="writingFeed">true if the writer is created for writing a feed; false when it is created for writing an entry.</param> /// <param name="writingParameter">true if the writer is created for writing a parameter; false otherwise.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonLightWriter( ODataJsonLightOutputContext jsonLightOutputContext, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool writingFeed, bool writingParameter = false, IODataReaderWriterListener listener = null) : base(jsonLightOutputContext, navigationSource, entityType, writingFeed, listener) { Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null"); this.jsonLightOutputContext = jsonLightOutputContext; this.jsonLightEntryAndFeedSerializer = new ODataJsonLightEntryAndFeedSerializer(this.jsonLightOutputContext); this.writingParameter = writingParameter; this.jsonWriter = this.jsonLightOutputContext.JsonWriter; this.odataAnnotationWriter = new JsonLightODataAnnotationWriter(this.jsonWriter, jsonLightOutputContext.MessageWriterSettings.ODataSimplified); }
/// <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="jsonLightOutputContext">The output context to write to.</param> /// <param name="navigationSource">The navigation source we are going to write entities for.</param> /// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param> /// <param name="writingFeed">true if the writer is created for writing a feed; false when it is created for writing an entry.</param> /// <param name="writingParameter">true if the writer is created for writing a parameter; false otherwise.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonLightWriter( ODataJsonLightOutputContext jsonLightOutputContext, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool writingFeed, bool writingParameter = false, IODataReaderWriterListener listener = null) : base(jsonLightOutputContext, navigationSource, entityType, writingFeed, listener) { Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null"); this.jsonLightOutputContext = jsonLightOutputContext; this.jsonLightEntryAndFeedSerializer = new ODataJsonLightEntryAndFeedSerializer(this.jsonLightOutputContext); this.writingParameter = writingParameter; this.jsonWriter = this.jsonLightOutputContext.JsonWriter; this.odataAnnotationWriter = new JsonLightODataAnnotationWriter(this.jsonWriter, jsonLightOutputContext.MessageWriterSettings.ODataSimplified); }
/// <summary> /// Constructor. /// </summary> /// <param name="inputContext">The input to read the payload from.</param> /// <param name="readingResourceSet">true if the reader is created for reading a resource set; false when it is created for reading a resource.</param> /// <param name="readingDelta">true if the reader is created for reading expanded navigation property in delta response; false otherwise.</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 readingResourceSet, bool readingDelta, IODataReaderWriterListener listener) { Debug.Assert(inputContext != null, "inputContext != null"); this.inputContext = inputContext; this.readingResourceSet = readingResourceSet; this.readingDelta = readingDelta; this.listener = listener; this.currentResourceDepth = 0; // create a collection validator when reading a top-level resource set and a user model is present if (this.readingResourceSet && this.inputContext.Model.IsUserModel()) { this.resourceSetValidator = new ResourceSetWithoutExpectedTypeValidator(); } }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The input to read the payload from.</param> /// <param name="navigationSource">The navigation source we are going to read entities for.</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="readingParameter">true if the reader is created for reading a parameter; false otherwise.</param> /// <param name="listener">If not null, the Json reader will notify the implementer of the interface of relevant state changes in the Json reader.</param> internal ODataJsonLightReader( ODataJsonLightInputContext jsonLightInputContext, IEdmNavigationSource navigationSource, IEdmEntityType expectedEntityType, bool readingFeed, bool readingParameter = false, IODataReaderWriterListener listener = null) : base(jsonLightInputContext, readingFeed, listener) { Debug.Assert(jsonLightInputContext != null, "jsonLightInputContext != null"); Debug.Assert( expectedEntityType == null || jsonLightInputContext.Model.IsUserModel(), "If the expected type is specified we need model as well. We should have verified that by now."); this.jsonLightInputContext = jsonLightInputContext; this.jsonLightEntryAndFeedDeserializer = new ODataJsonLightEntryAndFeedDeserializer(jsonLightInputContext); this.readingParameter = readingParameter; this.topLevelScope = new JsonLightTopLevelScope(navigationSource, expectedEntityType); this.EnterScope(this.topLevelScope); }
/// <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)); }
internal ODataAtomCollectionWriter(ODataAtomOutputContext atomOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(atomOutputContext, expectedItemType, listener) { this.atomOutputContext = atomOutputContext; this.atomCollectionSerializer = new ODataAtomCollectionSerializer(atomOutputContext); }
/// <summary> /// Constructor for creating a collection writer to use when writing parameter payloads. /// </summary> /// <param name="jsonLightOutputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonLightCollectionWriter(ODataJsonLightOutputContext jsonLightOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(jsonLightOutputContext, expectedItemType, listener) { Debug.Assert(jsonLightOutputContext != null, "jsonLightOutputContext != null"); Debug.Assert(!jsonLightOutputContext.WritingResponse, "The collection writer constructor for parameter payloads must only be used for writing requests."); this.jsonLightOutputContext = jsonLightOutputContext; this.jsonLightCollectionSerializer = new ODataJsonLightCollectionSerializer(this.jsonLightOutputContext, /*writingTopLevelCollection*/ false); }
internal ODataAtomCollectionWriter(ODataAtomOutputContext atomOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(atomOutputContext, expectedItemType, listener) { this.atomOutputContext = atomOutputContext; this.atomCollectionSerializer = new ODataAtomCollectionSerializer(atomOutputContext); }
internal ODataJsonCollectionWriter(ODataJsonOutputContext jsonOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(jsonOutputContext, expectedItemType, listener) { this.jsonOutputContext = jsonOutputContext; this.jsonCollectionSerializer = new ODataJsonCollectionSerializer(this.jsonOutputContext); }
internal ODataJsonCollectionReader(ODataJsonInputContext jsonInputContext, IEdmTypeReference expectedItemTypeReference, IODataReaderWriterListener listener) : base(jsonInputContext, expectedItemTypeReference, listener) { this.jsonInputContext = jsonInputContext; this.jsonCollectionDeserializer = new ODataJsonCollectionDeserializer(jsonInputContext); if (!jsonInputContext.Model.IsUserModel()) { throw new ODataException(Microsoft.Data.OData.Strings.ODataJsonCollectionReader_ParsingWithoutMetadata); } }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonOutputContext">The output context to write to.</param> /// <param name="expectedItemType">The type reference of the expected item type or null if no expected item type exists.</param> /// <param name="listener">If not null, the writer will notify the implementer of the interface of relevant state changes in the writer.</param> internal ODataJsonCollectionWriter(ODataJsonOutputContext jsonOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(jsonOutputContext, expectedItemType, listener) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(jsonOutputContext != null, "jsonOutputContext != null"); this.jsonOutputContext = jsonOutputContext; this.jsonCollectionSerializer = new ODataJsonCollectionSerializer(this.jsonOutputContext); }
internal ODataJsonReader(ODataJsonInputContext jsonInputContext, IEdmEntityType expectedEntityType, bool readingFeed, IODataReaderWriterListener listener) : base(jsonInputContext, expectedEntityType, readingFeed, listener) { this.jsonInputContext = jsonInputContext; this.jsonEntryAndFeedDeserializer = new ODataJsonEntryAndFeedDeserializer(jsonInputContext); if (!this.jsonInputContext.Model.IsUserModel()) { throw new ODataException(Microsoft.Data.OData.Strings.ODataJsonReader_ParsingWithoutMetadata); } }
internal ODataJsonCollectionWriter(ODataJsonOutputContext jsonOutputContext, IEdmTypeReference expectedItemType, IODataReaderWriterListener listener) : base(jsonOutputContext, expectedItemType, listener) { this.jsonOutputContext = jsonOutputContext; this.jsonCollectionSerializer = new ODataJsonCollectionSerializer(this.jsonOutputContext); }