Freigeben über


2.2.3.6.1.10 InlineCount System Query Option ($inlinecount)

Applies to the OData 2.0 and OData 3.0 protocols

A data service URI with an $inlinecount system query option specifies that the response to the request MUST include the count of the number of entities in the collection of entities, which are identified by the resource path section of the URI after all $filter system query options have been applied. A data service MAY support the $inlinecount system query option on a RetrieveEntity request. Actual counting of items in the EntitySet is data-service specific and no semantics for doing so are mandated. The InlineCount system query option is supported only in the OData 2.0 and OData 3.0 protocols.

The syntax of the InlineCount system query option is defined as follows.

 inlineCountQueryOp = "$inlinecount="
                      ("allpages" / "none")
  • If a value other than "allpages" or "none" is specified, the data service MUST return a 4xx error response code.

  • If a value of "none" is specified, the data service MUST NOT include the count in the response.

For information about including the count when using the AtomPub, JSON, and Verbose JSON serialization formats, refer to section 2.2.6.2.8 of this document, to section 4.5.4 of [ODataJSON4.0], and to section 2.2.6.3.9.1 of this document, respectively.

Examples:

 http://host/service.svc/Orders?$inlinecount=allpages

All order instances and the count of all order instances returned.

 http://host/service.svc/Orders?$inlinecount=allpages&$top=10

Returns the first 10 order instances and the count of all matching order instances.

 http://host/service.svc/Orders?$inlinecount=none&$top=10

Returns the first 10 order instances with no count of matching order instances.

 http://host/service.svc/Orders?$inlinecount=allpages&$filter=ShipCountry eq 'France'

Returns all order instances with ShipCountry equal to "France" and the count of all order instances with ShipCountry equal to "France".