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

Definice

Otestování načtení entity, kterou sleduje DataServiceContext odkaz na identifikátor URI 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

Parametry typu

TEntity

Typ entity.

Parametry

identity
Uri

Identifikátor URI sledované entity, která se má načíst.

entity
TEntity

Entita, která se má načíst.

Návraty

Pokud je entita nalezena na resourceUriadrese , vrátí se entita v parametru entity out a vrátí hodnotu true. Pokud se žádná entita nenajde, vrátí se false.

Výjimky

Kdy identity je null.

Poznámky

Pokud je entita Detached ve stavu nebo Added ve stavu, nemá identifikátor URI a nelze ji načíst pomocí této metody.

Platí pro