DataServiceContext.TryGetEntity<TEntity> メソッド

DataServiceContext によって追跡されているエンティティの取得を、そのエンティティの URI への参照によってテストします。

名前空間:  System.Data.Services.Client
アセンブリ:  Microsoft.Data.Services.Client (Microsoft.Data.Services.Client.dll)

構文

'宣言
Public Function TryGetEntity(Of TEntity As Class) ( _
    identity As Uri, _
    <OutAttribute> ByRef entity As TEntity _
) As Boolean
'使用
Dim instance As DataServiceContext
Dim identity As Uri
Dim entity As TEntity
Dim returnValue As Boolean

returnValue = instance.TryGetEntity(identity, _
    entity)
public bool TryGetEntity<TEntity>(
    Uri identity,
    out TEntity entity
)
where TEntity : class
public:
generic<typename TEntity>
where TEntity : ref class
bool TryGetEntity(
    Uri^ identity, 
    [OutAttribute] TEntity% entity
)
member TryGetEntity : 
        identity:Uri * 
        entity:'TEntity byref -> bool  when 'TEntity : not struct
JScript では、ジェネリックな型およびメソッドは使用できません。

型パラメーター

  • TEntity
    エンティティの型。

パラメーター

  • identity
    型: System.Uri
    取得する追跡対象エンティティの URI。
  • entity
    型: TEntity%
    取得するエンティティ。

戻り値

型: System.Boolean
エンティティが resourceUri で見つかった場合、そのエンティティは out パラメーター entity で返され、true が返されます。エンティティが見つからなかった場合は、false が返されます。

例外

例外 条件
ArgumentNullException

identity が nullNULL 参照 (Visual Basic では Nothing) の場合。

説明

エンティティの状態が Detached または Added の場合は、このエンティティは URI がないため、このメソッドを使用して取得することはできません。

関連項目

参照

DataServiceContext クラス

System.Data.Services.Client 名前空間