Example #1
0
        public async Task <OdataWcfQuery> Get(OdataWcfQuery request)
        {
            OeRequestHeaders headers = OeRequestHeaders.Parse(request.ContentType, request.Prefer);

            headers.ResponseContentType = headers.ContentType;

            Query.OeModelBoundProvider modelBoundProvider = null;
            if (headers.MaxPageSize > 0)
            {
                var pageNextLinkModelBoundBuilder = new PageNextLinkModelBoundBuilder(_edmModel, false);
                modelBoundProvider = pageNextLinkModelBoundBuilder.BuildProvider(headers.MaxPageSize, false);
            }
            var parser = new OeParser(_baseUri, _edmModel, modelBoundProvider);

            String query          = new StreamReader(request.Content).ReadToEnd();
            var    uri            = new Uri(_baseUri, new Uri(query, UriKind.Relative));
            var    responseStream = new MemoryStream();

            await parser.ExecuteGetAsync(uri, headers, responseStream, CancellationToken.None);

            responseStream.Position = 0;
            return(new OdataWcfQuery()
            {
                Content = responseStream,
                ContentType = headers.ResponseContentType
            });
        }
Example #2
0
        public async Task <OdataWcfQuery> Post(OdataWcfQuery request)
        {
            var parser         = new OeParser(_baseUri, _edmModel);
            var responseStream = new MemoryStream();
            await parser.ExecuteBatchAsync(request.Content, responseStream, request.ContentType, CancellationToken.None);

            responseStream.Position = 0;
            return(new OdataWcfQuery()
            {
                Content = responseStream,
                ContentType = request.ContentType
            });
        }
Example #3
0
        public async Task <OdataWcfQuery> Get(OdataWcfQuery request)
        {
            OeRequestHeaders headers = OeRequestHeaders.Parse(request.ContentType, request.Prefer);

            headers.ResponseContentType = headers.ContentType;
            var parser = new OeParser(_baseUri, _edmModel);

            String query          = new StreamReader(request.Content).ReadToEnd();
            var    uri            = new Uri(_baseUri, new Uri(query, UriKind.Relative));
            var    responseStream = new MemoryStream();

            await parser.ExecuteGetAsync(uri, headers, responseStream, CancellationToken.None);

            responseStream.Position = 0;
            return(new OdataWcfQuery()
            {
                Content = responseStream,
                ContentType = headers.ResponseContentType
            });
        }