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

Count is not translated well #677

Closed
Echarnus opened this issue Oct 18, 2019 · 3 comments
Closed

Count is not translated well #677

Echarnus opened this issue Oct 18, 2019 · 3 comments

Comments

@Echarnus
Copy link

Echarnus commented Oct 18, 2019

When I am using the .Count Fluent API function, my url is translated as https//somedomain.com/odata/myType/$count instead of https//somedomain.com/odata/myType/?count=true.

The API I am sending requests to is made in ASP.Net Core. Is it perhaps possible there are different implementations of OData, all though I thought it was a standard?

I am using version 5.9.0.

Edit: Same problem in 5.9.1.

@SiberaIndustries
Copy link

OData provides two different ways of using $count. Just check these two working examples:

  1. https://services.odata.org/V4/Northwind/Northwind.svc/Products?$count=true
  2. https://services.odata.org/V4/Northwind/Northwind.svc/Products/$count

The first returns all products in the value element of the JSON response and additionally it includes a @odata.count element, which represents the count of all products, no matter what filter you use.

The second returns the exact same count value, but it only returns the value as the raw response without any OData JSON result around.

You can find some Simple.Odata.Client examples at the end of the documentation:

@SiberaIndustries
Copy link

@Echarnus could you solve your issue?

@Echarnus
Copy link
Author

Echarnus commented Nov 20, 2019

Done. Apparently there is a bug in the OData library I used about this, or at least more people have the same problem, even at later versions: OData/WebApi#1153.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants