/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> protected ODataJsonLightDeserializer(ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { Debug.Assert(jsonLightInputContext != null, "jsonLightInputContext != null"); this.jsonLightInputContext = jsonLightInputContext; }
/// <summary> /// Detects the payload kind(s) from the message stream. /// </summary> /// <param name="messageStream">The message stream to read from for payload kind detection.</param> /// <param name="message">The message being read.</param> /// <param name="readingResponse">true if reading a response message; otherwise false.</param> /// <param name="detectionInfo">Additional information available for the payload kind detection.</param> /// <returns>An enumerable of zero, one or more payload kinds that were detected from looking at the payload in the message stream.</returns> private Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindImplementationAsync( Stream messageStream, ODataMessage message, bool readingResponse, ODataPayloadKindDetectionInfo detectionInfo) { ODataJsonLightInputContext jsonLightInputContext = new ODataJsonLightInputContext( this, messageStream, detectionInfo.ContentType, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, ODataVersion.V3, // NOTE: we don't rely on the version for payload kind detection; taking the latest. readingResponse, /*synchronous*/ false, detectionInfo.Model, /*urlResolver*/ null, /*payloadKindDetectionState*/ null); return(jsonLightInputContext.DetectPayloadKindAsync(detectionInfo) .FollowAlwaysWith(t => { jsonLightInputContext.Dispose(); })); }
/// <summary> /// Initializes a new <see cref="JsonLightAnnotationGroupDeserializer"/>. /// </summary> /// <param name="inputContext">The JSON light input context.</param> internal JsonLightAnnotationGroupDeserializer(ODataJsonLightInputContext inputContext) : base(inputContext) { DebugUtils.CheckNoExternalCallers(); this.annotationGroups = new Dictionary <string, ODataJsonLightAnnotationGroup>(EqualityComparer <string> .Default); }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> internal ODataJsonLightCollectionDeserializer(ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { DebugUtils.CheckNoExternalCallers(); this.duplicatePropertyNamesChecker = this.CreateDuplicatePropertyNamesChecker(); }
/// <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) { DebugUtils.CheckNoExternalCallers(); 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="functionImport">The function import whose parameters are being read.</param> internal ODataJsonLightParameterReader(ODataJsonLightInputContext jsonLightInputContext, IEdmFunctionImport functionImport) : base(jsonLightInputContext, functionImport) { DebugUtils.CheckNoExternalCallers(); Debug.Assert(jsonLightInputContext != null, "jsonLightInputContext != null"); Debug.Assert(jsonLightInputContext.ReadingResponse == false, "jsonLightInputContext.ReadingResponse == false"); Debug.Assert(functionImport != null, "functionImport != null"); this.jsonLightInputContext = jsonLightInputContext; this.jsonLightParameterDeserializer = new ODataJsonLightParameterDeserializer(this, jsonLightInputContext); Debug.Assert(this.jsonLightInputContext.Model.IsUserModel(), "this.jsonLightInputContext.Model.IsUserModel()"); }
/// <summary> /// Detects the payload kind(s) from the message stream. /// </summary> /// <param name="messageStream">The message stream to read from for payload kind detection.</param> /// <param name="message">The message being read.</param> /// <param name="readingResponse">true if reading a response message; otherwise false.</param> /// <param name="detectionInfo">Additional information available for the payload kind detection.</param> /// <returns>An enumerable of zero, one or more payload kinds that were detected from looking at the payload in the message stream.</returns> private IEnumerable <ODataPayloadKind> DetectPayloadKindImplementation( Stream messageStream, ODataMessage message, bool readingResponse, ODataPayloadKindDetectionInfo detectionInfo) { using (ODataJsonLightInputContext jsonLightInputContext = new ODataJsonLightInputContext( this, messageStream, detectionInfo.ContentType, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, ODataVersion.V3, // NOTE: we don't rely on the version for payload kind detection; taking the latest. readingResponse, /*synchronous*/ true, detectionInfo.Model, /*urlResolver*/ null, /*payloadKindDetectionState*/ null)) { return(jsonLightInputContext.DetectPayloadKind(detectionInfo)); } }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> internal ODataJsonLightErrorDeserializer(ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { DebugUtils.CheckNoExternalCallers(); }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> internal ODataJsonLightPayloadKindDetectionDeserializer(ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { DebugUtils.CheckNoExternalCallers(); }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> internal ODataJsonLightEntityReferenceLinkDeserializer(ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { DebugUtils.CheckNoExternalCallers(); }
/// <summary> /// Constructor. /// </summary> /// <param name="parameterReader">The JSON Light parameter reader.</param> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> internal ODataJsonLightParameterDeserializer(ODataJsonLightParameterReader parameterReader, ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { DebugUtils.CheckNoExternalCallers(); this.parameterReader = parameterReader; }
/// <summary> /// Constructor. /// </summary> /// <param name="jsonLightInputContext">The JsonLight input context to read from.</param> internal ODataJsonLightServiceDocumentDeserializer(ODataJsonLightInputContext jsonLightInputContext) : base(jsonLightInputContext) { DebugUtils.CheckNoExternalCallers(); }