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 virtual bool TryGetEntity<TEntity> (Uri identity, out TEntity entity) where TEntity : class;
abstract member TryGetEntity : Uri * 'Entity -> bool (requires 'Entity : null)
override this.TryGetEntity : Uri * 'Entity -> bool (requires 'Entity : null)
Public Overridable 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 identity, 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

entities in added state are not likely to have a identity

Applies to