OData-EnableQuery query params filter, select, top prevents the step-by-step processing of IEnumerable and the complete ODataController handle IEnumerable results without enumeration/streaming the output data
Open
@corranrogue9 is already working on this.
Since Mar 8, 2022.
investigating
- Dominant language
- C#
- Stars
- 505
- Forks
- 186
- PR merge metrics
- No merged PRs in 30d
Description
.NET6 & OData 8.0.8
If a controller returns an IEnumerable as result, this is requested completely. This was partially correct in .NET Core 3.1. Especially with the parameter $top this has always been broken.
public class ApiStreamTestController : ControllerBase
{...
[HttpGet]
[EnableQuery]
public IEnumerable<StreamTestModel> Get(){ foreach (var row in StreamTestModelData.DataCache) yield return row; }
}...
public class StreamTestController : ODataController
{
[HttpGet]
[EnableQuery]
public IEnumerable<StreamTestModel> Get(){ foreach (var row in StreamTestModelData.DataCache) yield return row; }
...}
Here the complete foreach is queried if OData parameters are used.
The complete code with the test is attached StreamTest.NET6.zip
Summary:
ODataController
- ODataStreamingTest_Raw_are_not_supported
- ODataStreamingTest_Filter_And_Select_are_not_supported
- ODataStreamingTest_Top_is_not_supported
- ODataStreamingTest_OrderBy_cannot_work (it's ok)
ControllerBase
- StreamingTest_Raw_are_supported
- StreamingTest_Filter_And_Select_are_not_supported
- StreamingTest_Top_is_not_supported
- StreamingTest_OrderBy_cannot_work (it's ok)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.