DevForce Help Reference
FirstOrNullEntity(IEntityQuery) Method
Example 


Executes the query and returns the first element of the sequence, or the appropriate NullEntity if no element is found.
Syntax
'Declaration
 
<ExtensionAttribute()>
Public Overloads Shared Function FirstOrNullEntity( _
   ByVal query As IEntityQuery _
) As Object
'Usage
 
Dim query As IEntityQuery
Dim value As Object
 
value = EntityQueryExtensions.FirstOrNullEntity(query)
[Extension()]
public static object FirstOrNullEntity( 
   IEntityQuery query
)

Parameters

query
Remarks
Because the query is untyped the result is also not strongly typed. You can cast the result to the correct type.
Example
var mgr = new DomainModelEntityManager();
var query = new EntityKeyQuery(new EntityKey(typeof(Customer), 1));
Customer cust = query.With(mgr).FirstOrNullEntity() as Customer;
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

EntityQueryExtensions Class
EntityQueryExtensions Members
Overload List

Send Feedback