DataServiceContext.TryGetUri(Object, Uri) Method

Definition

Retrieves the canonical URI associated with the specified entity, if available.

C#
public bool TryGetUri(object entity, out Uri identity);

Parameters

entity
Object

The entity identified by the identity.

identity
Uri

The URI of the entity.

Returns

Returns true if the canonical URI is returned in the out parameter. If the specified entity is not tracked by the DataServiceContext or is in the added state, no URI is available and false is returned.

Exceptions

When entity is null.

Remarks

Objects in the Added state do not yet have a URI.

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1