private OeAsyncEnumerator ExecuteGet(IEdmModel refModel, ODataUri odataUri, OeRequestHeaders headers, CancellationToken cancellationToken, IQueryable source) { var parser = new OeGetParser(refModel); _queryContext = parser.CreateQueryContext(odataUri, headers.MaxPageSize, headers.NavigationNextLink, headers.MetadataLevel); if (odataUri.Path.LastSegment is OperationSegment) { return(OeOperationHelper.ApplyBoundFunction(_queryContext)); } if (source != null) { _queryContext.QueryableSource = e => e == _queryContext.EntryFactory.EntitySet ? source : null; } if (_queryContext.IsCountSegment) { headers.ResponseContentType = OeRequestHeaders.TextDefault.ContentType; int count = _dataAdapter.ExecuteScalar <int>(_dataContext, _queryContext); return(new OeScalarAsyncEnumeratorAdapter(Task.FromResult((Object)count), cancellationToken)); } return(_dataAdapter.ExecuteEnumerator(_dataContext, _queryContext, cancellationToken)); }
private OeAsyncEnumerator Execute(OeRequestHeaders headers, Stream responseStream, CancellationToken cancellationToken) { _dataContext = _dataAdapter.CreateDataContext(); if (_queryContext.IsCountSegment) { headers.ResponseContentType = OeRequestHeaders.TextDefault.ContentType; int count = _dataAdapter.ExecuteScalar <int>(_dataContext, _queryContext); return(new OeScalarAsyncEnumeratorAdapter(Task.FromResult((Object)count), cancellationToken)); } return(_dataAdapter.ExecuteEnumerator(_dataContext, _queryContext, cancellationToken)); }