Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Link<EntityT, LinkedEntityT>

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: the Link class represents navigation properties with a 1:n cardinality. For navigation properties with a 1:0..1 cardinality, see OneToOneLink.

See also: Selectable

Type parameters

  • EntityT: Entity

    Type of the entity to be linked from

  • LinkedEntityT: Entity

    Type of the entity to be linked to

Hierarchy

Implements

  • EntityIdentifiable<EntityT>

Index

Constructors

constructor

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

    Parameters

    • _fieldName: string

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

    • _entityConstructor: Constructable<EntityT>

      Constructor type of the entity the field belongs to

    • _linkedEntity: Constructable<LinkedEntityT>

      Constructor type of the linked entity

    Returns Link

Properties

_entityConstructor

_entityConstructor: Constructable<EntityT>

Constructor type of the entity the field belongs to

_fieldName

_fieldName: string

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

_linkedEntity

_linkedEntity: Constructable<LinkedEntityT>

Constructor type of the linked entity

selects

selects: Array<Selectable<LinkedEntityT>> = []

List of selectables on the linked entity.

Methods

select

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

    See also, Selectable

    Parameters

    • Rest ...selects: Array<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<EntityT, LinkedEntityT>(link: Link<EntityT, LinkedEntityT>): Link<EntityT, LinkedEntityT>
  • Create a new link based on a given link.

    Type parameters

    • EntityT: Entity

      Type of the entity to be linked from

    • LinkedEntityT: Entity

      Type of the entity to be linked to

    Parameters

    • link: Link<EntityT, LinkedEntityT>

      Link to be cloned

    Returns Link<EntityT, LinkedEntityT>

    Newly created link