IdeaBlade DevForce 2010 Help Reference
FirstOrNullEntity(IEntityQuery) Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > EntityQueryExtensions Class > FirstOrNullEntity Method : FirstOrNullEntity(IEntityQuery) Method



query
Executes the query and returns the first element of the sequence, or the appropriate NullEntity if no element is found.

Syntax

Visual Basic (Declaration) 
<ExtensionAttribute()>
Public Overloads Shared Function FirstOrNullEntity( _
   ByVal query As IEntityQuery _
) As Object
Visual Basic (Usage)Copy Code
Dim query As IEntityQuery
Dim value As Object
 
value = EntityQueryExtensions.FirstOrNullEntity(query)
C# 
[ExtensionAttribute()]
public static object FirstOrNullEntity( 
   IEntityQuery query
)
C++/CLI 
[ExtensionAttribute()]
public:
static Object^ FirstOrNullEntity( 
   IEntityQuery^ query
) 

Parameters

query

Example

C#Copy Code
var mgr = new DomainModelEntityManager();
var query = new EntityKeyQuery(new EntityKey(typeof(Customer), 1));
Customer cust = query.With(mgr).FirstOrNullEntity() as Customer;

Remarks

Because the query is untyped the result is also not strongly typed. You can cast the result to the correct type.

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.