Поделиться через


DataServiceContext.TryGetEntity<TEntity> Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Tests retrieval of an entity being tracked by the DataServiceContext by reference to the URI of the entity.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

Syntax

'Declaration
Public Function TryGetEntity(Of TEntity As Class) ( _
    identity As Uri, _
    <OutAttribute> ByRef entity As TEntity _
) As Boolean
public bool TryGetEntity<TEntity>(
    Uri identity,
    out TEntity entity
)
where TEntity : class

Type Parameters

  • TEntity
    The type of the entity.

Parameters

  • identity
    Type: System.Uri
    The URI of the tracked entity to be retrieved.
  • entity
    Type: TEntity%
    The entity to be retrieved.

Return Value

Type: System.Boolean
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

Exception Condition
ArgumentNullException

When identity is nulla null reference (Nothing in Visual Basic).

Remarks

If an entity is detached or in the added state, by definition, it does not have a URI and cannot be retrieved using this method.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.