Skip to content

Partner navigation property of an uplink defines collection, but only for one level #2067

@HeikoTheissen

Description

@HeikoTheissen

If composition of entities is expressed through containment navigation properties, every entity type can have an uplink non-containment navigation property that addresses its parent in the composition hierarchy. Partner navigation properties can then be used to define the collection that contains the navigation target.

For every composition A -> B there is a pair of navigation properties:

<EntityType Name="A">
  <NavigationProperty Name="B" Type="Collection(ns.B)" ContainsTarget="true" Partner="uplink" />
</EntityType>
<EntityType Name="B">
  <NavigationProperty Name="C" Type="Collection(ns.C)" ContainsTarget="true" Partner="uplink" />
  <NavigationProperty Name="uplink" Type="ns.A" Partner="B" />
</EntityType>

If a resource path $P$ identifies an entity of type A, then $P$/B(key)/uplink is the same entity as the one identified by $P$.

If would be good if this also worked for uplinks that go up more than one level:

<EntityType Name="C">
  <NavigationProperty Name="uplink" Type="ns.B" Partner="C" />
  <NavigationProperty Name="upuplink" Type="ns.A" Partner="B/C" />
</EntityType>

But Partner="B/C" is not allowed according to OData-CSDL, section 8.3

The path MAY traverse complex types, including derived complex types, but MUST NOT traverse any navigation properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions