OData / OData/AspNetCoreOData

TotalCountFunc evaluated before IQueryable is enumerated

Open
#516 6 comments 0 reactions 2 assignees View on GitHub

@gathogojr is already working on this.

Since Mar 15, 2022.

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

Description

ODataResourceSetSerializer.CreateResourceSet executes the TotalCountFunc, but that is called before the IQueryable is evaluated in ODataResourceSetSerializer.WriteResourceSetAsync and thus the TotalCountFunc can never know anything about what filters were requested, and thus always returns the wrong result when using TotalCountFunc.

resourceSetInstance.GetEnumerator() MUST be called before executing TotalCountFunc!

This is a critical problem.

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.