IdeaBlade.EntityModel.Compat Assembly > IdeaBlade.EntityModel.Compat Namespace > EntityScalarQueryAsyncExtensions Class > SingleOrNullEntity Method : SingleOrNullEntity<TSource>(IEntityScalarQuery<TSource>,Action<EntityScalarQueryOperation<TSource>>,Object) Method |
'Declaration
<ExtensionAttribute()> Public Overloads Shared Function SingleOrNullEntity(Of TSource)( _ ByVal source As IEntityScalarQuery(Of TSource), _ ByVal userCallback As Action(Of EntityScalarQueryOperation(Of TSource)), _ Optional ByVal userState As Object _ ) As EntityScalarQueryOperation(Of TSource)
'Usage
Dim source As IEntityScalarQuery(Of TSource) Dim userCallback As Action(Of EntityScalarQueryOperation(Of TSource)) Dim userState As Object Dim value As EntityScalarQueryOperation(Of TSource) value = EntityScalarQueryAsyncExtensions.SingleOrNullEntity(Of TSource)(source, userCallback, userState)
[Extension()] public static EntityScalarQueryOperation<TSource> SingleOrNullEntity<TSource>( IEntityScalarQuery<TSource> source, Action<EntityScalarQueryOperation<TSource>> userCallback, object userState )
public void AsyncSingleOrNullEntity() { var op = _entityManager.Employees.Where(e => e.Id == 1).AsScalarAsync().SingleOrNullEntity(); op.Completed += (o, e) => { var emp = e.Result; }; }
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