C#:
// Get
the Default PersistenceManager.
PersistenceManager
pm = PersistenceManager.DefaultManager;
// This
is the query for all orders placed
within the last 7 days.
RdbQuery
query1 = new RdbQuery(typeof(Order),
Order.OrderDateEntityColumn, EntityQueryOp.GT,
DateTime.Today - new TimeSpan(7, 0, 0, 0));
// Register
an event handler to be called
when the query completes.
pm.GetEntitiesCompleted
+= new EventHandler(pm_GetEntitiesCompleted);
// Start
the executing query.
// when it completes, the pm_GetEntitiesCompleted
// referenced above will be called.
// The token "anyValue" will be returned in the
// GetEntitiesCompletedEventArgs to distinguish
// this async call from any others.
pm.GetEntitiesAsync(q,
QueryStrategy.DataSourceOnly, "anyValue");
VB.NET:
'
Get the Default PersistenceManager.
Dim
pm As PersistenceManager
= PersistenceManager.DefaultManager
' This
is the query for all orders placed
within the last 7 days.
Dim
q As RdbQuery = New
RdbQuery (GetType (Order),
_
Order.OrderDateEntityColumn, EntityQueryOp.GT, _
DateTime.Today - New TimeSpan(7, 0, 0, 0))
' Register
an event handler to be called
when the query completes.
AddHandler
pm.GetEntitiesCompleted,
AddressOf _
New EventHandler(Of GetEntitiesCompletedEventArgs) _
(pm_GetEntitiesCompleted)
' Start
the executing query.
' When it completes, the pm_GetEntitiesCompleted referenced above
' will be called.
' The token "anyValue" will be returned in the
' GetEntitiesCompletedEventArgs to distinguish
' this async call from any others.
pm.GetEntitiesAsync(q,
QueryStrategy.DataSourceOnly, _
"anyValue")
|