DataServiceContext.TryGetUri(Object, Uri) Method

Definition

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

public virtual bool TryGetUri (object entity, out Uri identity);
abstract member TryGetUri : obj * Uri -> bool
override this.TryGetUri : obj * Uri -> bool
Public Overridable Function TryGetUri (entity As Object, ByRef identity As Uri) As Boolean

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

Entities in added state are not likely to have an identity. Though the identity might use a dereferencable scheme, you MUST NOT assume it can be dereferenced.

Applies to