Annotations: introduce path segment to address the count of a collection

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • V4.0_WD01
    • Affects Version/s: V4.0_WD01
    • Component/s: CSDL XML
    • None
    • Environment:

      [Proposed]

      Annotations: introduce path segment to address the count of a collection: We could use /$count or @odata.count.
      The first is consistent with URL rules, the second with odata.mediaContentType etc. that we introduced recently in ODATA-227.

      <?xml version="1.0" encoding="utf-8"?>
      <edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
      <edmx:Reference Url="http://services.odata.org/V3/OData/OData.svc/$metadata" />
      <edmx:DataServices>
      <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="CountSample" Alias="CS">

      <Term Name="MostImportantDataFields" Type="Collection(CS.DataFieldType)" />
      <ComplexType Name="DataFieldType">
      <Property Name="Label" Type="String" Nullable="true" />
      <Property Name="Value" Type="Edm.PrimitiveType" Nullable="false" />
      <Property Name="NavigationPath" Type="Edm.NavigationPropertyPath" Nullable="true" />
      </ComplexType>

      <Annotations Target="ODataDemo.Category">
      <Annotation Term="CS.MostImportantDataFields">
      <Collection>
      <Record>
      <PropertyValue Property="Label" String="Category Name" />
      <PropertyValue Property="Value" Path="Name" />
      </Record>
      <Record>
      <PropertyValue Property="Label" String="Numbers of Products related to this Category" />
      <!-- Alternative 1 -->
      <PropertyValue Property="Value" Path="Products/$count" /> <!-- see $orderby and $filter -->
      <!-- Alternative 2 -->
      <PropertyValue Property="Value" Path="Products/@odata.count" /><!-- see CSDL 16.2.10 The edm:Path Expression -->
      <PropertyValue Property="NavigationPath" NavigationPropertyPath="Products" />
      </Record>
      </Collection>
      </Annotation>
      </Annotations>
      </Schema>
      </edmx:DataServices>
      </edmx:Edmx>

            Assignee:
            handl
            Reporter:
            martinzurmuehl
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: