DataServiceContext.TryGetEntity<TEntity>(Uri, TEntity) Method

Definition

Test retrieval of an entity being tracked by the DataServiceContext by reference to the URI of the entity.

C#
public bool TryGetEntity<TEntity>(Uri identity, out TEntity entity) where TEntity : class;

Type Parameters

TEntity

The type of the entity.

Parameters

identity
Uri

The URI of the tracked entity to be retrieved.

entity
TEntity

The entity to be retrieved.

Returns

If an entity is found at resourceUri, the entity is returned in the out parameter entity and true is returned. If no entity is found, false is returned.

Exceptions

When identity is null.

Remarks

If an entity is in the Detached or Added state, it does not have a URI and cannot be retrieved by using this method.

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