Visual Basic (Declaration) | |
---|---|
Public Overloads Function ExecuteQueryAsync(Of T)( _ ByVal query As IEntityQuery(Of T), _ Optional ByVal userCallback As Action(Of EntityQueryOperation(Of T)), _ Optional ByVal userState As Object _ ) As EntityQueryOperation(Of T) |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As EntityManager Dim query As IEntityQuery(Of T) Dim userCallback As Action(Of EntityQueryOperation(Of T)) Dim userState As Object Dim value As EntityQueryOperation(Of T) value = instance.ExecuteQueryAsync(Of T)(query, userCallback, userState) |
C# | |
---|---|
public EntityQueryOperation<T> ExecuteQueryAsync<T>( IEntityQuery<T> query, Action<EntityQueryOperation<T>> userCallback, object userState ) |
C++/CLI | |
---|---|
public: EntityQueryOperation<T^>^ ExecuteQueryAsyncgeneric<typename T> ( IEntityQuery<T^>^ query, Action<EntityQueryOperation<T^>^>^ userCallback, Object^ userState ) |
Parameters
- query
- The IEntityQuery to execute
- userCallback
- Callback invoked when the query completes
- userState
- Token to identify the query upon completion
Type Parameters
- T
- Entity type queried
C# | ![]() |
---|---|
private void SampleAsynchQuery() { DomainModelEntityManager mgr = new DomainModelEntityManager(); // Build a query and ask mgr to run it asynchronously. var query = mgr.Customers.Where(c => c.CompanyName.StartsWith("C")); int token = 1; mgr.ExecuteQueryAsync(query, AsyncQueryCompleted, token); } void AsyncQueryCompleted(EntityQueryOperation<Customer> e) { if (e.Error != null) { System.Diagnostics.Debug.WriteLine(e.Error.Message); return; } System.Diagnostics.Debug.WriteLine("queryid = " + e.UserState.ToString()); System.Diagnostics.Debug.WriteLine("customers retrieved = " + e.Results.Count().ToString()); } |
Provide a userCallback if you want to be notified when the operation completes. The query results will be returned in the EntityQueriedEventArgs passed to the userCallback. Use the userState to uniquely identify this call. You can cancel a pending asynchronous call using CancelAsync.
This feature is only available in certain editions of DevForce.
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