/// <summary> /// Asynchronously detects the payload kinds supported by this format for the specified message payload. /// </summary> /// <param name="messageInfo">The context information for the message.</param> /// <param name="settings">Configuration settings of the OData reader.</param> /// <returns>A task that when completed returns the set of <see cref="ODataPayloadKind"/>s /// that are supported with the specified payload.</returns> public override Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindAsync( ODataMessageInfo messageInfo, ODataMessageReaderSettings settings) { ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo"); return(messageInfo.GetMessageStreamAsync() .FollowOnSuccessWithTask(streamTask => this.DetectPayloadKindImplementationAsync( streamTask.Result, /*readingResponse*/ messageInfo.IsResponse, new ODataPayloadKindDetectionInfo( messageInfo.MediaType, messageInfo.Encoding, settings, messageInfo.Model)))); }
public override System.Threading.Tasks.Task <ODataInputContext> CreateInputContextAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings) { return(messageInfo.GetMessageStreamAsync() .ContinueWith( (streamTask) => (ODataInputContext) new VCardInputContext( this, streamTask.Result, messageInfo.MediaType, messageInfo.Encoding, messageReaderSettings, messageInfo.IsResponse, /*sync*/ false, messageInfo.Model, messageInfo.UrlResolver), TaskContinuationOptions.NotOnFaulted)); }
/// <summary> /// Creates an instance of the output context for this format. /// </summary> /// <param name="messageInfo">The context information for the message.</param> /// <param name="messageWriterSettings">Configuration settings of the OData writer.</param> /// <returns>Task which represents the pending create operation.</returns> public override Task <ODataOutputContext> CreateOutputContextAsync( ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings) { ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo"); ExceptionUtils.CheckArgumentNotNull(messageWriterSettings, "messageWriterSettings"); return(messageInfo.GetMessageStreamAsync() .FollowOnSuccessWith( (streamTask) => (ODataOutputContext) new ODataAtomOutputContext( this, streamTask.Result, messageInfo.Encoding, messageWriterSettings, messageInfo.IsResponse, /*synchronous*/ false, messageInfo.Model, messageInfo.UrlResolver))); }
/// <summary> /// Creates an instance of the output context for this format. /// </summary> /// <param name="messageInfo">The context information for the message.</param> /// <param name="messageWriterSettings">Configuration settings of the OData writer.</param> /// <returns>Task which represents the pending create operation.</returns> public override Task<ODataOutputContext> CreateOutputContextAsync( ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings) { ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo"); ExceptionUtils.CheckArgumentNotNull(messageWriterSettings, "messageWriterSettings"); return messageInfo.GetMessageStreamAsync() .FollowOnSuccessWith( (streamTask) => (ODataOutputContext)new ODataAtomOutputContext( this, streamTask.Result, messageInfo.Encoding, messageWriterSettings, messageInfo.IsResponse, /*synchronous*/ false, messageInfo.Model, messageInfo.UrlResolver)); }
/// <summary> /// Asynchronously detects the payload kinds supported by this format for the specified message payload. /// </summary> /// <param name="messageInfo">The context information for the message.</param> /// <param name="settings">Configuration settings of the OData reader.</param> /// <returns>A task that when completed returns the set of <see cref="ODataPayloadKind"/>s /// that are supported with the specified payload.</returns> public override Task<IEnumerable<ODataPayloadKind>> DetectPayloadKindAsync( ODataMessageInfo messageInfo, ODataMessageReaderSettings settings) { ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo"); return messageInfo.GetMessageStreamAsync() .FollowOnSuccessWith( streamTask => this.DetectPayloadKindImplementation( streamTask.Result, /*readingResponse*/ messageInfo.IsResponse, /*synchronous*/ false, new ODataPayloadKindDetectionInfo( messageInfo.MediaType, messageInfo.Encoding, settings, messageInfo.Model))); }