DevForce Help Reference
FirstOrNullEntity(IEntityScalarQuery,CancellationToken) Method
Example 


Returns the first element in the sequence, or the appropriate NullEntity if the sequence contains no elements. Pass in a System.Threading.CancellationToken to cancel operation.
Syntax
'Declaration
 
<ExtensionAttribute()>
Public Overloads Shared Function FirstOrNullEntity( _
   ByVal source As IEntityScalarQuery, _
   ByVal cancellationToken As CancellationToken _
) As Task(Of Object)
'Usage
 
Dim source As IEntityScalarQuery
Dim cancellationToken As CancellationToken
Dim value As Task(Of Object)
 
value = EntityScalarAsyncExtensions.FirstOrNullEntity(source, cancellationToken)

Parameters

source
cancellationToken
Example
public async void AsyncFirstOrNullEntity() {
  Employee emp = await _entityManager.Employees.AsScalarAsync().FirstOrNullEntity();
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

EntityScalarAsyncExtensions Class
EntityScalarAsyncExtensions Members
Overload List

Send Feedback