Table of Contents

TXDataModel.CanonicalUrlFromEntity Method

Builds the canonical URL of an entity from the entity itself.

Remarks

Raises ECannotBuildCanonicalUrl if no entity set publishes the entity type.

Syntax

Unit: XData.Model.Classes

function TXDataModel.CanonicalUrlFromEntity(EntityType: TXDataEntityType; const Entity: TValue; GetPropValue: TXDataGetPropValueProc; GetNavPropValue: TXDataGetNavPropValueProc; AEncoded: Boolean = False; AEntityKeyAsSegment: Boolean = False): string;

Parameters

<-> Parameter Type Description
EntityType TXDataEntityType The entity type of the entity.
const Entity TValue The entity to build the URL for.
GetPropValue TXDataGetProp​Value​Proc Function used to read the values of the simple key properties of the entity.
GetNavPropValue TXDataGetNav​Prop​Value​Proc Function used to read the associated entities, when a key property is an association.
AEncoded Boolean Optional: Default value is False

If True, the returned URL is percent-encoded.
AEntityKeyAsSegment Boolean Optional: Default value is False

If True, the key is written as a separate segment, as in Customer/1. Otherwise it uses the format Customer(1).

Returns

The canonical URL of the entity, relative to the base URL of the server, without trailing slash.

See also