OData / OData/AspNetCoreOData

When [Select] attribute on Entity without [Page(MaxTop = 100)] attribute, then MaxTop set to 0

Open
#695 9 comments 1 reaction 1 assignee View on GitHub

@ElizabethOkerio is already working on this.

Since Sep 13, 2022.

bug
Dominant language
C#
Stars
505
Forks
186
PR merge metrics
No merged PRs in 30d

Description

Assemblies affected
ASP.NET Core OData 8.x

Describe the bug
When [Select] attribute on Entity without [Page(MaxTop = 100)] attribute, then MaxTop set to 0
For entity without [Select] attribute all ok, MaxTop set from global
services.AddControllers().AddOData(opt => opt.Count().Filter().Expand().Select().OrderBy().SetMaxTop(100000).AddRouteComponents("odata", GetEdmModel()))

Reproduce steps
1
[Select(SelectType = SelectExpandType.Automatic)]
[Select(nameof(Memo), SelectType = SelectExpandType.Allowed)]
//[Page(MaxTop = 1000000)]
public class Ware ...

2
try url /odata/Ware?$top=10

3
result is
"The query specified in the URI is not valid. The limit of '0' for Top query has been exceeded. The value from the incoming request is '10'."

Data Model

EDM (CSDL) Model

Request/Response

Expected behavior
When Page attribute absent, then MaxTop get from global.

Screenshots

Additional context

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.