Closed Robelind closed 2 years ago
$count=true should work.
I don't think $count
by itself is exposed by ODataQueryOptions.Count
otherwise a PR would be welcome.
http://localhost:56168/api/Items?$count-true
returns all items.
http://localhost:56168/api/Items?$count=true
returns all items and the count.
Correct. "$count-true" was a typo - meant to say "$count=true" like in the link.
Thought as much, but still doesn't solve the problem.
You want only the count, not the items, which http://localhost:56168/api/Items/$count
accomplishes with the controller implementation not using the OData extension.
If you're seeing a solution then it's ok to create a PR.
I'm having problems retrieving the count for an entity type.
Controller:
Request:
Result:
Changing the controller implementation to this works as expected: