voronov-maxim / OdataToEntity

OData .net core
MIT License
153 stars 32 forks source link

Support for inline counts (?$count=true) #30

Closed techniq closed 5 years ago

techniq commented 5 years ago

The $count system query option ignores any $top, $skip, or $expand query options, and returns the total count of results across all pages including only those results matching any specified $filter and $search

Will include "@odata.count": {NUMBER}, in the response with the total number of entries across all pages (taking into affect the $filter) which is really useful for paginated interfaces (data tables, etc). Implementations I've seen have been to issue a second select count(*) ... query.

Specification: 11.2.5.5 System Query Option $count

Example: https://services.odata.org/Experimental/Northwind/Northwind.svc/Customers?$count=true&$top=5

voronov-maxim commented 5 years ago

CountExpandNested CountQueryParameter CountQueryParameterFilter

techniq commented 5 years ago

Hmm... when calling one of the Test Controllers I do not get the @odata.count in the response.

image

techniq commented 5 years ago

I believe the issue is the expectation of a OeAsyncEnumerator here

image