Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextLinks (paging) of expanded child collections are resolved before enumeration #1384

Open
uffelauesen opened this issue Jan 6, 2025 · 1 comment · May be fixed by #1393
Open

NextLinks (paging) of expanded child collections are resolved before enumeration #1384

uffelauesen opened this issue Jan 6, 2025 · 1 comment · May be fixed by #1393
Labels
bug Something isn't working

Comments

@uffelauesen
Copy link
Contributor

Assemblies affected
ASP.NET Core OData 8.x

Describe the bug
The NextLinkGenerator to use for nested resource sets are resolved before we actually know if there are any more resources (that is before enumeration of the resources). The child resource set is checked for implementing ITruncatedCollection but also if it IsTruncated before it has been enumerated. In my provider I do not know if it has acually been truncated until after enumeration.

Reproduce steps
Implement ITruncatedCollection for some child collection property and observe that the ODataResourceSetSerializer will call it's IsTruncated before it has been enumerated.

Data Model
NA

EDM (CSDL) Model
NA

Request/Response
NA

Expected behavior
The IsTruncated is called after enumeration of the child collection when the nextLink is about to be written.

Screenshots
NA

Additional context
I am trying to avoid having to override the default ODataResourceSetSerializer to get this to work as expected. The overriding of the serializer contains alot of replicated code that makes it hard to maintain as we need to revisit whenever the standard serializer changes (and it did just that recently). See also #1382

@uffelauesen uffelauesen added the bug Something isn't working label Jan 6, 2025
uffelauesen added a commit to uffelauesen/AspNetCoreOData that referenced this issue Jan 6, 2025
@uffelauesen
Copy link
Contributor Author

Fixed by #1383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant