Share via


AsyncEntitySetController<TEntity, TKey>.GetEntityByKeyAsync Method

This method should be overridden to retrieve an entity by key from the entity set.

Namespace:  System.Web.Http.OData
Assembly:  System.Web.Http.OData (in System.Web.Http.OData.dll)

Syntax

'Declaration
Protected Friend Overridable Function GetEntityByKeyAsync ( _
    key As TKey _
) As Task(Of TEntity)
'Usage
Dim key As TKey
Dim returnValue As Task(Of TEntity)

returnValue = Me.GetEntityByKeyAsync(key)
protected internal virtual Task<TEntity> GetEntityByKeyAsync(
    TKey key
)
protected public:
virtual Task<TEntity>^ GetEntityByKeyAsync(
    TKey key
)
abstract GetEntityByKeyAsync : 
        key:'TKey -> Task<'TEntity> 
override GetEntityByKeyAsync : 
        key:'TKey -> Task<'TEntity> 
function GetEntityByKeyAsync(
    key : TKey
) : Task<TEntity>

Parameters

  • key
    Type: TKey
    The entity key of the entity to retrieve.

Return Value

Type: System.Threading.Tasks.Task<TEntity>
A Task that contains the retrieved entity when it completes, or null if an entity with the specified entity key cannot be found in the entity set.

See Also

Reference

AsyncEntitySetController<TEntity, TKey> Class

System.Web.Http.OData Namespace