Man*_*tti 11 odata asp.net-web-api asp.net-web-api-odata
有没有什么方法可以只计算响应有效负载中的数据而没有任何值数组?
我正在使用带有Webapi 2.2的ODataV4.0.目前,当我查询以下内容时,它会返回所有值和计数:
http://odata/People?$count=true
我只需要喜欢"@odata.count":1, "value":[]或不喜欢的东西"value".
是这项工作的唯一方法吗?
Law*_*pin 24
将$ top设置为零,将$ count设置为true.
例如:http: //services.odata.org/V4/Northwind/Northwind.svc/Customers?$count=true&$top=0
返回计数但没有结果
{"@ odata.context":" http://services.odata.org/V4/Northwind/Northwind.svc/ $ metadata#Customers","@ odata.count":91,"value":[]}
应用$ filter后计算计数,但不考虑$ top和$ skip.
例如:http://services.odata.org/V4/Northwind/Northwind.svc/Customers?$count=true&$top=0&$filter=Country%20eq%20%27Germany%27
通知您有11个国家/地区是"德国"的结果,但没有在响应中返回任何记录.
abs*_*ths 11
您还可以附加 $count 作为路径元素来获取原始计数,EG,
https://services.odata.org/V4/Northwind/Northwind.svc/Customers/ $count
这也适用于过滤器等,应用:https : //services.odata.org/V4/Northwind/Northwind.svc/Customers/ $count?$filter=Country%20eq%20%27Germany%27
对于德国的客户计数。
| 归档时间: |
|
| 查看次数: |
9062 次 |
| 最近记录: |