OData / OData/AspNetCoreOData

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
#515 1 comment 1 reaction 1 assignee View on GitHub

@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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.