AspNetCoreOData
AspNetCoreOData copied to clipboard
Ability to override, modify ,or disable Expand -> PageSize?
I can specify [EnableQuery(PageSize = 1)]
Which returns 1 item
{
"@odata.context": "",
"value": [
{
"id": "caaac39-b1f4-4fee-d2d2-08d951a5b8b7",
"name": "Test.txt",
"description": ""
}
],
"@odata.nextLink": "...$skip=1"
}
When I add an Expand it returns one item with one item inside also
{
"@odata.context": "",
"value": [
{
"id": "caaac39-b1f4-4fee-d2d2-08d951a5b8b7",
"name": "Test.txt",
"description": "",
"versions": [
{
"id": "aaaa86ac-4c33-4ca4-6a34-08d951a5b8da",
"gcrId": "caaaac39-b1f4-4fee-d2d2-08d951a5b8b7",
"version": "9.0"
}
],
"[email protected]": "...?$skip=1"
}
],
"@odata.nextLink": "...$skip=1"
}
I ideally want that to be a different number is there a way to specify expand PageSize?
Many thanks Peter
Please use the "Discussions" tab to ask questions in repositories that have that enabled in the future.
I would say it is undesirable functionality. Which I would class as a bug. Updated the title @julealgon
As it applies the PageSize to the nested Expands.
I'm not seeing a way to override or modify or disable it for the expands.
Looks like this is similar to #1041
Did you try configuring the page size in the EDM model builder for each type instead of in the [EnableQuery] attribute @p6345uk ?
yes
[Page(MaxTop = 30, PageSize = 5)]
I have this specified on my expand which works in isolation. However Adding [EnableQuery(PageSize = 1)] on the endpoint overrides this on the expand.
What about not setting that PageSize on EnableQuery then @p6345uk ? Doesn't that give you the behavior you want?
BTW, I wasn't referring to the Page attribute when I said in the EDM model builder. I was talking about the place where you configure your EDM model (I'm assuming you are using an EDM model?).
I Have tried setting that however
Something similar to builder.EntityType<T>().Page(maxTopValue, pageSizeValue);
It seems to just ignore it. Or it doesn't have the next links.
I think I'm going to try to extract the functionality and put together an example so you fully see what I'm doing
@p6345uk any update? same issue for me. I have an entity with a child list, if I do an expand, the child list adds unwanted pagination(LIMIT in mysql).
Yea no update. Not found any way round it yet