QuerySpec
The QuerySpec API is similar to the normal QuerySpec api for fetching data: we've added async variants of all the QuerySpec API methods for fetching data.
Per method there are two overloads: one which accepts a CancellationToken, and one which doesn't. The one which doesn't calls the overload which does accept a CancellationToken and passes CancellationToken.None as CancellationToken. The methods available are grouped in two sections below, one for Adapter and one SelfServicing.
To get details about the various methods, please consult the LLBLGen Pro Runtime Library Reference Manual, which is an additional download from the LLBLGen Pro website.
All nested queries inside QuerySpec queries as well as prefetch path definitions are executed asynchronously if the main query is executed asynchronously as well.
Adapter
The async QuerySpec api for Adapter has the following methods. All
methods are extension methods of IDataAccessAdapter and should be
called, like their synchronous equivalents, on a DataAccessAdapter
instance. The methods below are mentioned with the parameter types as if
they're called on DataAccessAdapter, so
FetchQueryAsync<TEntity>(EntityQuery<TEntity>)
is the method
which is called as:
var q = // create entity query here
var adapter = new DataAccessAdapter();
var results = await adapter.FetchQueryAsync(q);
The naming scheme of the async methods is as follows: all method names are based on the format SynchronousMethodEquivalentAsync. So FetchQueryAsync is the asynchronous variant of FetchQuery, with the same behavior, input and output.
- FetchQueryAsync<TEntity>(EntityQuery<TEntity>)
- FetchQueryAsync<TEntity, TCollection>(EntityQuery<TEntity>, TCollection)
- FetchFirstAsync<TEntity>(EntityQuery<TEntity>)
- FetchSingleAsync<TEntity>(EntityQuery<TEntity>)
- FetchFirstAsync<T>(DynamicQuery<T>)
- FetchSingleAsync<T>(DynamicQuery<T>)
- FetchScalarAsync<TValue>(DynamicQuery)
- FetchQueryAsync(DynamicQuery)
- FetchQueryAsync<TElement>(DynamicQuery<TElement>)
- FetchAsProjectionAsync(DynamicQuery, IGeneralDataProjector)
- FetchAsDataReaderAsync(DynamicQuery, CommandBehavior)
- FetchAsDataTableAsync(DynamicQuery)
- FetchAsDataTableAsync(DynamicQuery, DataTable)
- FetchQueryFromSourceAsync<T>(DynamicQuery<T>, IRetrievalQuery)
SelfServicing
Selfservicing too has an async QuerySpec API, which consists of async equivalents of the synchronous API methods. The async methods use the same naming scheme as with Adapter described above, and also have overloads which accept a CancellationToken. As SelfServicing QuerySpec methods are called on more than one object, they're specified with the method below.
- entitycollection.GetMultiAsync<TEntity>(EntityQuery<TEntity>)
- entityQuery<TEntity>.GetFirstAsync<TEntity>()
- entityQuery<TEntity>.GetFirstAsync<TEntity> (Transaction)
- entityQuery<TEntity>.GetSingleAsync<TEntity> ()
- entityQuery<TEntity>.GetSingleAsync<TEntity> (Transaction)
- dao.GetFirstAsync<T>(DynamicQuery<T>)
- dao.GetFirstAsync<T>(DynamicQuery<T>, Transaction)
- dao.GetSingleAsync<T>(DynamicQuery<T>)
- dao.GetSingleAsync<T>(DynamicQuery<T>, Transaction)
- dao.FetchQueryAsync<TElement>(DynamicQuery<TElement>)
- dao.FetchQueryAsync<TElement>(DynamicQuery<TElement>, Transaction)
- dao.FetchQueryAsync (DynamicQuery)
- dao.FetchQueryAsync (DynamicQuery, Transaction)
- dao.GetScalarAsync<TValue>(DynamicQuery)
- dao.GetScalarAsync<TValue>(DynamicQuery, Transaction)
- dao.FetchAsProjectionAsync(Transaction, DynamicQuery, IGeneralDataProjector)
- dao.FetchAsDataReaderAsync(Transaction, DynamicQuery, CommandBehavior)
- dao.FetchAsDataTable(DynamicQuery)
- dao.FetchAsDataTable(DynamicQuery, Transaction)
- dao.FetchAsDataTable(DynamicQuery, DataTable)
- dao.FetchAsDataTable(DynamicQuery, DataTable, Transaction)
- dao.FetchQueryFromSourceAsync<T>(DynamicQuery<T>, IRetrievalQuery)
- dao.FetchQueryFromSourceAsync<T>(Transaction, DynamicQuery<T>, IRetrievalQuery)