Uploaded image for project: 'OASIS Open Data Protocol (OData) TC'
  1. OASIS Open Data Protocol (OData) TC
  2. ODATA-340

How to retrieve both the entity references as well as the count of a collection referenced by a navigation property?



    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: V4.0_WD01
    • Fix Version/s: V4.0_WD01
    • Component/s: Protocol
    • Labels:
    • Environment:



      Currently if we want to retrieve the references to the individual entities instead of inlining the entities themselves the $expand syntax allows us to append /$ref to the navigation property that represents that collection of entities. If we wanted the size of that collection, after optionally applying any filters that might have been specified for such collection, one would need to add the $inlinecount ($count if ODATA-339 gets accepted) to be included as one of the expand options. This leads to the question how one could get both the count as well as the references to the individual entities as well as, come to think about it, how one could specify the order in which these references ought to be returned.

      In ODATA-339 the proposal is to allow /$count to be appended to a property in the select clause if one wanted to retrieve just the count. I was wondering if $ref should be moved to the select clause as well where $ref became just one of those special properties allowed to be used as appended to a navigation property or in a select nested within an expand were $ref would just be this 'special' property that would result in the reference to be injected in the projection and were it might optionally be combined with other properties (if that made sense)???

      I.e. these would then all be valid:

      http://host/service.svr/Customers?$select=Orders/($count,$select=$ref,$filter=Amount gt 100)




            • Assignee:
              handl Ralf Handl
              hubert.heijkers Hubert Heijkers
            • Watchers:
              0 Start watching this issue


              • Created: