AutoMapper / AutoMapper.Extensions.OData

Creates LINQ expressions from ODataQueryOptions and executes the query.
MIT License
140 stars 38 forks source link

[Question] How to enable OData paging? #79

Closed DanielGlos closed 3 years ago

DanielGlos commented 3 years ago

As the documentation says you are not supposed to use [EnableQuery] attribute when using GetQueryAsync method. My question is how can we enable OData paging which is usually done by setting PageSize e.g. [EnableQuery(PageSize=10)]. Also when in my Startup class I set MaxTop like this: endpoints.Select().Expand().Filter().OrderBy().Count().MaxTop(10); It is ignored when [EnableQuery] attribute is not present in the controller.

Are there any plans on allowing [EnableQuery] with GetQueryAsync?

BlaiseD commented 3 years ago

No plans to allow [EnableQuery] - it ends up duplicating the logic.

I would recommend a new ODataSettings class to be a child property of QuerySettings if you need to set the page size on the server - plus logic to define precedence over $top.

QuerySettings.HandleNullPropagationOption can be moved to the new class - I think it's only been there in preview.

dasariramacharan commented 3 years ago

@BlaiseD Any plans to implement ODATA Paging support?

BlaiseD commented 3 years ago

No plans to implement server-side paging but PRs are welcome.

You'll have to add a PageSize property to ODataSettings and give it precedence over $top when we build the expression.