Exemplo n.º 1
0
 /// <summary>
 /// 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>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
 public override IEnumerable<ODataPayloadKind> DetectPayloadKind(
     ODataMessageInfo messageInfo,
     ODataMessageReaderSettings settings)
 {
     ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo");
     return DetectPayloadKindImplementation(messageInfo.MediaType);
 }
Exemplo n.º 2
0
        /// <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");

            throw new ODataException(Strings.General_InternalError(InternalErrorCodes.ODataMetadataFormat_CreateOutputContextAsync));
        }
Exemplo n.º 3
0
 public CsvOutputContext(
     ODataFormat format,
     ODataMessageWriterSettings settings,
     ODataMessageInfo messageInfo,
     bool synchronous)
     : base(format, settings, messageInfo.IsResponse, synchronous, messageInfo.Model, messageInfo.UrlResolver)
 {
     this.stream = messageInfo.GetMessageStream();
     this.Writer = new StreamWriter(this.stream);
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 /// <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.IsResponse
         ? messageInfo.GetMessageStreamAsync()
            .FollowOnSuccessWith(streamTask => DetectPayloadKindImplementation(
                                     streamTask.Result,
                                     new ODataPayloadKindDetectionInfo(
                                         messageInfo.MediaType,
                                         messageInfo.Encoding,
                                         settings,
                                         messageInfo.Model)))
         : TaskUtils.GetCompletedTask(Enumerable.Empty <ODataPayloadKind>()));
 }
Exemplo n.º 6
0
        /// <summary>
        /// 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>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
        public override IEnumerable <ODataPayloadKind> DetectPayloadKind(
            ODataMessageInfo messageInfo,
            ODataMessageReaderSettings settings)
        {
            ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo");

            // Metadata is not supported in requests!
            return(messageInfo.IsResponse
                ? DetectPayloadKindImplementation(
                       messageInfo.GetMessageStream(),
                       new ODataPayloadKindDetectionInfo(
                           messageInfo.MediaType,
                           messageInfo.Encoding,
                           settings,
                           messageInfo.Model))
                : Enumerable.Empty <ODataPayloadKind>());
        }
Exemplo n.º 7
0
        /// <summary>
        /// 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>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
        public override IEnumerable<ODataPayloadKind> DetectPayloadKind(
            ODataMessageInfo messageInfo,
            ODataMessageReaderSettings settings)
        {
            ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo");

            // Metadata is not supported in requests!
            return messageInfo.IsResponse
                ? DetectPayloadKindImplementation(
                    messageInfo.GetMessageStream(),
                    new ODataPayloadKindDetectionInfo(
                        messageInfo.MediaType,
                        messageInfo.Encoding,
                        settings,
                        messageInfo.Model))
                : Enumerable.Empty<ODataPayloadKind>();
        }
Exemplo n.º 8
0
        /// <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>The newly created output context.</returns>
        public override ODataOutputContext CreateOutputContext(
            ODataMessageInfo messageInfo,
            ODataMessageWriterSettings messageWriterSettings)
        {
            ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo");
            ExceptionUtils.CheckArgumentNotNull(messageWriterSettings, "messageWriterSettings");

            return(new ODataRawOutputContext(
                       this,
                       messageInfo.GetMessageStream(),
                       messageInfo.Encoding,
                       messageWriterSettings,
                       messageInfo.IsResponse,
                       /*synchronous*/ true,
                       messageInfo.Model,
                       messageInfo.UrlResolver));
        }
Exemplo n.º 9
0
        /// <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>The newly created output context.</returns>
        public override ODataOutputContext CreateOutputContext(
            ODataMessageInfo messageInfo,
            ODataMessageWriterSettings messageWriterSettings)
        {
            ExceptionUtils.CheckArgumentNotNull(messageInfo, "messageInfo");
            ExceptionUtils.CheckArgumentNotNull(messageWriterSettings, "messageWriterSettings");

            return new ODataRawOutputContext(
                this,
                messageInfo.GetMessageStream(),
                messageInfo.Encoding,
                messageWriterSettings,
                messageInfo.IsResponse,
                /*synchronous*/ true,
                messageInfo.Model,
                messageInfo.UrlResolver);
        }
Exemplo n.º 10
0
        /// <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 ODataRawOutputContext(
                           this,
                           streamTask.Result,
                           messageInfo.Encoding,
                           messageWriterSettings,
                           messageInfo.IsResponse,
                           /*synchronous*/ false,
                           messageInfo.Model,
                           messageInfo.UrlResolver)));
        }
Exemplo n.º 11
0
 /// <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>
 /// <remarks>
 /// The stream returned by GetMessageStream of <paramref name="messageInfo"/> could be used for reading for
 /// payload kind detection. Reading this stream won't affect later reading operations of payload processing.
 /// </remarks>
 public abstract Task<IEnumerable<ODataPayloadKind>> DetectPayloadKindAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings);
Exemplo n.º 12
0
 public override System.Threading.Tasks.Task<System.Collections.Generic.IEnumerable<ODataPayloadKind>> DetectPayloadKindAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 13
0
 public override ODataInputContext CreateInputContext(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 14
0
 /// <summary>
 /// Asynchronously creates an instance of the input context for this format.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="messageReaderSettings">Configuration settings of the OData reader.</param>
 /// <returns>Task which when completed returned the newly created input context.</returns>
 public abstract Task <ODataInputContext> CreateInputContextAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings);
Exemplo n.º 15
0
 /// <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>The newly created output context.</returns>
 public abstract ODataOutputContext CreateOutputContext(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings);
Exemplo n.º 16
0
 /// <summary>
 /// 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>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
 /// <remarks>
 /// The stream returned by GetMessageStream of <paramref name="messageInfo"/> could be used for reading for
 /// payload kind detection. Reading this stream won't affect later reading operations of payload processing.
 /// </remarks>
 public abstract IEnumerable <ODataPayloadKind> DetectPayloadKind(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings);
Exemplo n.º 17
0
 /// <summary>
 /// Creates an instance of the input context for this format.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="messageReaderSettings">Configuration settings of the OData reader.</param>
 /// <returns>The newly created input context.</returns>
 public abstract ODataInputContext CreateInputContext(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings);
Exemplo n.º 18
0
 public override ODataOutputContext CreateOutputContext(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings)
 {
     return new VCardOutputContext(this, messageInfo.GetMessageStream(), messageInfo.Encoding, messageWriterSettings, messageInfo.IsResponse, true, messageInfo.Model, messageInfo.UrlResolver);
 }
Exemplo n.º 19
0
 public override ODataInputContext CreateInputContext(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings)
 {
     return new VCardInputContext(this, messageInfo.GetMessageStream(), messageInfo.MediaType, messageInfo.Encoding, messageReaderSettings, messageInfo.IsResponse, true, messageInfo.Model, messageInfo.UrlResolver);
 }
Exemplo n.º 20
0
 public override IEnumerable<ODataPayloadKind> DetectPayloadKind(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 21
0
 /// <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 abstract Task<ODataOutputContext> CreateOutputContextAsync(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings);
Exemplo n.º 22
0
 /// <summary>
 /// Asynchronously creates an instance of the input context for this format.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="messageReaderSettings">Configuration settings of the OData reader.</param>
 /// <returns>Task which when completed returned the newly created input context.</returns>
 public abstract Task<ODataInputContext> CreateInputContextAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings);
Exemplo n.º 23
0
 /// <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.IsResponse
         ? messageInfo.GetMessageStreamAsync()
             .FollowOnSuccessWith(streamTask => DetectPayloadKindImplementation(
                     streamTask.Result,
                     new ODataPayloadKindDetectionInfo(
                         messageInfo.MediaType,
                         messageInfo.Encoding,
                         settings,
                         messageInfo.Model)))
         : TaskUtils.GetCompletedTask(Enumerable.Empty<ODataPayloadKind>());
 }
Exemplo n.º 24
0
        /// <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");

            throw new ODataException(Strings.General_InternalError(InternalErrorCodes.ODataMetadataFormat_CreateOutputContextAsync));
        }
Exemplo n.º 25
0
 /// <summary>
 /// Creates an instance of the input context for this format.
 /// </summary>
 /// <param name="messageInfo">The context information for the message.</param>
 /// <param name="messageReaderSettings">Configuration settings of the OData reader.</param>
 /// <returns>The newly created input context.</returns>
 public abstract ODataInputContext CreateInputContext(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings);
Exemplo n.º 26
0
 /// <summary>
 /// 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>The set of <see cref="ODataPayloadKind"/>s that are supported with the specified payload.</returns>
 /// <remarks>
 /// The stream returned by GetMessageStream of <paramref name="messageInfo"/> could be used for reading for
 /// payload kind detection. Reading this stream won't affect later reading operations of payload processing.
 /// </remarks>
 public abstract IEnumerable<ODataPayloadKind> DetectPayloadKind(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings);
Exemplo n.º 27
0
 /// <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>
 /// <remarks>
 /// The stream returned by GetMessageStream of <paramref name="messageInfo"/> could be used for reading for
 /// payload kind detection. Reading this stream won't affect later reading operations of payload processing.
 /// </remarks>
 public abstract Task <IEnumerable <ODataPayloadKind> > DetectPayloadKindAsync(ODataMessageInfo messageInfo, ODataMessageReaderSettings settings);
Exemplo n.º 28
0
 /// <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 TaskUtils.GetTaskForSynchronousOperation(() => DetectPayloadKindImplementation(messageInfo.MediaType));
 }
Exemplo n.º 29
0
 /// <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 abstract Task <ODataOutputContext> CreateOutputContextAsync(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings);
Exemplo n.º 30
0
        /// <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 ODataRawOutputContext(
                        this,
                        streamTask.Result,
                        messageInfo.Encoding,
                        messageWriterSettings,
                        messageInfo.IsResponse,
                        /*synchronous*/ false,
                        messageInfo.Model,
                        messageInfo.UrlResolver));
        }
Exemplo n.º 31
0
 public override System.Threading.Tasks.Task<ODataOutputContext> CreateOutputContextAsync(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 32
0
 public override ODataOutputContext CreateOutputContext(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 33
0
 public override ODataOutputContext CreateOutputContext(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings)
 {
     return new CsvOutputContext(this, messageWriterSettings, messageInfo, synchronous: true);
 }
Exemplo n.º 34
0
 /// <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>The newly created output context.</returns>
 public abstract ODataOutputContext CreateOutputContext(ODataMessageInfo messageInfo, ODataMessageWriterSettings messageWriterSettings);