Exemplo n.º 1
0
        /// <summary>
        /// Creates ODataMessageReader
        /// </summary>
        /// <param name="messageStream">Message stream</param>
        /// <param name="model">Edm model</param>
        /// <returns>Instance of ODataMessageReader</returns>
        public static ODataMessageReader CreateMessageReader(Stream messageStream, IEdmModel model)
        {
            var settings = CreateMessageReaderSettings(true);
            var message  = new StreamBasedRequestMessage(messageStream);

            message.SetHeader(ODataConstants.ContentTypeHeader, ContentType);
            return(new ODataMessageReader(message, settings, model));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates ODataMessageReader
        /// </summary>
        /// <param name="messageStream">Message stream</param>
        /// <param name="model">Edm model</param>
        /// <param name="messageKind">Is request or response</param>
        /// <param name="isFullValidation">Whether turn on EnableFullValidation</param>
        /// <returns>Instance of ODataMessageReader</returns>
        public static ODataMessageReader CreateMessageReader(Stream messageStream, IEdmModel model, ODataMessageKind messageKind, bool isFullValidation)
        {
            var settings = CreateMessageReaderSettings(isFullValidation);

            if (messageKind == ODataMessageKind.Request)
            {
                var message = new StreamBasedRequestMessage(messageStream);
                message.SetHeader(ODataConstants.ContentTypeHeader, ContentType);
                return(new ODataMessageReader(message, settings, model));
            }
            else
            {
                var message = new StreamBasedResponseMessage(messageStream);
                message.SetHeader(ODataConstants.ContentTypeHeader, ContentType);
                return(new ODataMessageReader(message, settings, model));
            }
        }