/// <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.V4, // 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> /// Detects the payload kind(s) from the message stream. /// </summary> /// <param name="messageInfo">The context information for the message.</param> /// <param name="settings">Configuration settings of the OData reader.</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 static IEnumerable <ODataPayloadKind> DetectPayloadKindImplementation( ODataMessageInfo messageInfo, ODataMessageReaderSettings settings) { var detectionInfo = new ODataPayloadKindDetectionInfo(messageInfo, settings); messageInfo.Encoding = detectionInfo.GetEncoding(); using (var jsonLightInputContext = new ODataJsonLightInputContext(messageInfo, settings)) { return(jsonLightInputContext.DetectPayloadKind(detectionInfo)); } }
/// <summary> /// Detects the payload kind(s) from the message stream. /// </summary> /// <param name="messageInfo">The context information for the message.</param> /// <param name="settings">Configuration settings of the OData reader.</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 static Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindImplementationAsync( ODataMessageInfo messageInfo, ODataMessageReaderSettings settings) { var detectionInfo = new ODataPayloadKindDetectionInfo(messageInfo, settings); messageInfo.Encoding = detectionInfo.GetEncoding(); var jsonLightInputContext = new ODataJsonLightInputContext(messageInfo, settings); return(jsonLightInputContext.DetectPayloadKindAsync(detectionInfo) .FollowAlwaysWith(t => { jsonLightInputContext.Dispose(); })); }
/// <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="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, bool readingResponse, ODataPayloadKindDetectionInfo detectionInfo) { using (ODataJsonLightInputContext jsonLightInputContext = new ODataJsonLightInputContext( this, messageStream, detectionInfo.ContentType, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, readingResponse, /*synchronous*/ true, detectionInfo.Model, /*urlResolver*/ null)) { return(jsonLightInputContext.DetectPayloadKind(detectionInfo)); } }
/// <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="readingResponse">true if reading a response message; otherwise false.</param> /// <param name="synchronous">true if the input should be read synchronously; false if it should be read asynchronously.</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, bool readingResponse, bool synchronous, ODataPayloadKindDetectionInfo detectionInfo) { using (ODataJsonInputContext jsonInputContext = new ODataJsonInputContext( this, messageStream, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, ODataVersion.V3, // NOTE: we don't rely on the version for payload kind detection; taking the latest. readingResponse, synchronous, detectionInfo.Model, /*urlResolver*/ null)) { return(jsonInputContext.DetectPayloadKind()); } }
/// <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="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, bool readingResponse, ODataPayloadKindDetectionInfo detectionInfo) { ODataJsonLightInputContext jsonLightInputContext = new ODataJsonLightInputContext( this, messageStream, detectionInfo.ContentType, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, readingResponse, /*synchronous*/ false, detectionInfo.Model, /*urlResolver*/ null); return(jsonLightInputContext.DetectPayloadKindAsync(detectionInfo) .FollowAlwaysWith(t => { jsonLightInputContext.Dispose(); })); }
/// <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="readingResponse">true if reading a response message; otherwise false.</param> /// <param name="synchronous">true if the input should be read synchronously; false if it should be read asynchronously.</param> /// <param name="detectionInfo">Additional information available for the payload kind detection.</param> /// <returns>An enumerable of zero or more payload kinds depending on what payload kinds were detected.</returns> private IEnumerable<ODataPayloadKind> DetectPayloadKindImplementation( Stream messageStream, bool readingResponse, bool synchronous, ODataPayloadKindDetectionInfo detectionInfo) { using (ODataAtomInputContext inputContext = new ODataAtomInputContext( this, messageStream, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, ODataVersion.V3, // NOTE: we don't rely on the version for payload kind detection; taking the latest. readingResponse, synchronous, detectionInfo.Model, /*urlResolver*/ null)) { return inputContext.DetectPayloadKind(detectionInfo); } }
/// <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="readingResponse">true if reading a response message; otherwise false.</param> /// <param name="synchronous">true if the input should be read synchronously; false if it should be read asynchronously.</param> /// <param name="detectionInfo">Additional information available for the payload kind detection.</param> /// <returns>An enumerable of zero or more payload kinds depending on what payload kinds were detected.</returns> private IEnumerable<ODataPayloadKind> DetectPayloadKindImplementation( Stream messageStream, bool readingResponse, bool synchronous, ODataPayloadKindDetectionInfo detectionInfo) { using (ODataAtomInputContext inputContext = new ODataAtomInputContext( this, messageStream, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, readingResponse, synchronous, detectionInfo.Model, /*urlResolver*/ null)) { return inputContext.DetectPayloadKind(detectionInfo); } }
private IEnumerable <ODataPayloadKind> DetectPayloadKindImplementation(Stream messageStream, bool readingResponse, bool synchronous, ODataPayloadKindDetectionInfo detectionInfo) { using (ODataAtomInputContext context = new ODataAtomInputContext(this, messageStream, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, ODataVersion.V3, readingResponse, synchronous, detectionInfo.Model, null)) { return(context.DetectPayloadKind(detectionInfo)); } }
/// <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="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, bool readingResponse, ODataPayloadKindDetectionInfo detectionInfo) { ODataJsonLightInputContext jsonLightInputContext = new ODataJsonLightInputContext( this, messageStream, detectionInfo.ContentType, detectionInfo.GetEncoding(), detectionInfo.MessageReaderSettings, readingResponse, /*synchronous*/ false, detectionInfo.Model, /*urlResolver*/ null); return jsonLightInputContext.DetectPayloadKindAsync(detectionInfo) .FollowAlwaysWith(t => { jsonLightInputContext.Dispose(); }); }