• Public
  • Public/Protected
  • All

Represents a navigation property of an OData entity.

OData is a relational data model, i.e. entities can be related to one another. For example, BusinessPartner is in a 1:n relation with BusinessPartnerAddress and in a 1:1 relation with Customer. Like normal properties, navigation properties can be used for selecting (expanding) and filtering. For example, when constructing a query on the BusinessPartner entity, an instance of Link<BusinessPartner, Customer> can be passed as argument to the select function, e.g. BusinessPartner.TO_CUSTOMER.

NOTE: Due to historical development the Link and its extensions are used in the following way: OData v2 entity: 1:N is a Link, 1:0..1 is a OneToOneLink OData v4 entity: 1:N is a OneToManyLink, 1:0..1 is a OneToOneLink

See also: Selectable

Type parameters

  • EntityT: EntityBase

    Type of the entity to be linked from

  • LinkedEntityT: EntityBase = any

    Type of the entity to be linked to



  • EntityIdentifiable<EntityT>




  • new Link<EntityT, LinkedEntityT>(_fieldName: string, _entityConstructor: Constructable<EntityT, unknown>, _linkedEntity: Constructable<LinkedEntityT, unknown>): Link<EntityT, LinkedEntityT>
  • Creates an instance of Link.

    Type parameters


    • _fieldName: string

      Name of the linking field to be used in the OData request.

    • _entityConstructor: Constructable<EntityT, unknown>

      Constructor type of the entity the field belongs to

    • _linkedEntity: Constructable<LinkedEntityT, unknown>

      Constructor type of the linked entity

    Returns Link<EntityT, LinkedEntityT>


Readonly _entity

_entity: EntityT

Readonly _entityConstructor

_entityConstructor: Constructable<EntityT, unknown>


_expand: Expandable<LinkedEntityT>[]

Readonly _fieldName

_fieldName: string

Readonly _linkedEntity

_linkedEntity: Constructable<LinkedEntityT, unknown>


_selects: Selectable<LinkedEntityT>[]

List of selectables on the linked entity.



  • deprecated

    Since v1.21.0. Use _selects directly. List of selectables on the linked entity.

    Returns Selectable<LinkedEntityT>[]



  • clone(): Link<EntityT, LinkedEntityT>
  • Create a new link based on a given link.

    Returns Link<EntityT, LinkedEntityT>

    Newly created link


  • expand(...expands: Expandable<LinkedEntityT>[]): Link<EntityT, LinkedEntityT>
  • Parameters

    Returns Link<EntityT, LinkedEntityT>


  • select(...selects: Selectable<LinkedEntityT>[]): Link<EntityT, LinkedEntityT>
  • Creates a selection on a linked entity. Has the same behavior as GetAllRequestBuilderV2.select and GetByKeyRequestBuilderV4.select but for linked entities.

    See also, Selectable


    • Rest ...selects: Selectable<LinkedEntityT>[]

      Selection of fields or links on a linked entity

    Returns Link<EntityT, LinkedEntityT>

    The link itself, to facilitate method chaining

Static clone

  • clone<EntityT1, LinkedEntityT1>(link: Link<EntityT1, LinkedEntityT1>): Link<EntityT1, LinkedEntityT1>
  • deprecated

    Since v1.21.0. Use clone instead. Create a new link based on a given link.

    Type parameters


    • link: Link<EntityT1, LinkedEntityT1>

      Link to be cloned

    Returns Link<EntityT1, LinkedEntityT1>

    Newly created link

    Copyright Ⓒ 2021 SAP SE or an SAP affiliate company. All rights reserved.