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.

public:
generic <typename TEntity>
 where TEntity : class bool TryGetEntity(Uri ^ identity, [Runtime::InteropServices::Out] TEntity % entity);
public bool TryGetEntity<TEntity> (Uri identity, out TEntity entity) where TEntity : class;
member this.TryGetEntity : Uri * 'Entity -> bool (requires 'Entity : null)
Public Function TryGetEntity(Of TEntity As Class) (identity As Uri, ByRef entity As TEntity) As Boolean

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