IdeaBlade DevForce 2010 Help Reference
Single(IEntityScalarQuery,Action<EntityScalarQueryOperation>,Object) Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityScalarAsyncExtensions Class > Single Method : Single(IEntityScalarQuery,Action<EntityScalarQueryOperation>,Object) Method



source
userCallback
userState
Returns the only element of a sequence, and throws an exception if there is not exactly one element in the sequence.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Function Single( _
   ByVal source As IEntityScalarQuery, _
   Optional ByVal userCallback As Action(Of EntityScalarQueryOperation), _
   Optional ByVal userState As Object _
) As EntityScalarQueryOperation
Visual Basic (Usage)Copy Code
Dim source As IEntityScalarQuery
Dim userCallback As Action(Of EntityScalarQueryOperation)
Dim userState As Object
Dim value As EntityScalarQueryOperation
 
value = EntityScalarAsyncExtensions.Single(source, userCallback, userState)

Parameters

source
userCallback
userState

Example

C#Copy Code
public void AsyncSingle() {
  var op = _entityManager.Employees.Where(e => e.Id == 1).AsScalarAsync().Single();
  op.Completed += (o, e) => {
    var emp = e.Result;
  };
}

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.