TXDataModel.CanonicalUrlFromId Method
Builds the canonical URL of an entity from its identifier.
Remarks
Raises ECannotBuildCanonicalUrl if no entity set publishes the entity type, and ECannotBuildKeyPredicateWrongValueLength if the number of values in Id does not match the number of key properties.
Syntax
Unit: XData.Model.Classes
function TXDataModel.CanonicalUrlFromId(EntityType: TXDataEntityType; Id: TValue; AEncoded: Boolean = False; AEntityKeyAsSegment: Boolean = False): string; overload;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| EntityType | TXDataEntityType | The entity type of the entity. | |
| Id | TValue | The identifier of the entity. For entity types with a composite key, it must be an array of TValue with one value for each key property, in the same order as the key properties. |
|
| 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. For example, Customer(15) for a customer whose identifier is 15.