다음을 통해 공유


DataServiceContext.TryGetEntity<TEntity> 메서드

엔터티 URI를 참조하여 DataServiceContext에서 추적 중인 엔터티의 검색을 테스트합니다.

네임스페이스:  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에서 엔터티가 검색된 경우 출력 매개 변수 entity로 엔터티가 반환되고 true가 반환됩니다.검색된 엔터티가 없는 경우 false가 반환됩니다.

예외

예외 조건
ArgumentNullException

identity가 nullnull 참조(Visual Basic에서는 Nothing)인 경우

주의

엔터티가 Detached 또는 Added 상태인 경우에는 URI가 없으므로 이 메서드를 사용하여 검색할 수 없습니다.

참고 항목

참조

DataServiceContext 클래스

System.Data.Services.Client 네임스페이스