Emmanuel wrote:
I'm sorry but I still don't understand. I want an async version of something that will return typedview rows, not datareader rows.
That's what Walaa's example does
See: http://www.llblgen.com/Documentation/5.0/LLBLGen%20Pro%20RTF/Using%20the%20generated%20code/Adapter/Using%20TypedViews,%20TypedLists%20and%20Dynamic%20Lists/gencode_usingtypedview_adapter.htm
Scroll down to 'OutputType: PocoWithQuerySpecQuery'. ->
OutputType: PocoWithQuerySpecQuery
For QuerySpec, retrieving a poco typed view mapped onto a stored procedure resultset comes down to using two parts:
- Obtain the projection lamdba from the QueryFactory. This projection is produced by the method TypedViewNameTypedViewProjection
- Pass it to the method in RetrievalProcedures which fetches the actual typed view.
This looks like the following:
var results = RetrievalProcedures.FetchCustomersOnCountryQsTypedView(
new QueryFactory().GetCustomersOnCountryTypedViewProjection(), "USA");
Alternatively, you can use FetchQueryFromSource to do the same:
List<CustomersOnCountryRow> results;
using(var adapter = new DataAccessAdapter())
{
results = adapter.FetchQueryFromSource(
new QueryFactory().GetCustomersOnCountryTypedViewProjection(),
RetrievalProcedures.GetCustomersOnCountryCallAsQuery("USA");
}
The async variant is simply calling the Async variant of FetchQueryFromSource and awaiting it, so it then becomes:
List<CustomersOnCountryRow> results;
using(var adapter = new DataAccessAdapter())
{
results = await adapter.FetchQueryFromSourceAsync(
new QueryFactory().GetCustomersOnCountryTypedViewProjection(),
RetrievalProcedures.GetCustomersOnCountryCallAsQuery("USA");
}
And, I don't understand what that second snippet of code does. My QueryFactory does not have any FetchQuery... method for my stored procedures.
The fetch method is on the adapter, not the query factory
It produces a projection, and a query specification, then passes them to FetchQueryFromSource/FetchQueryFromSourceAsync().
Looking at the generated QueryFactory code, it seems it only generates factory methods that return entity types and not typedview types.
Did you set the output type of the typed view to PocoWithQuerySpecQUery? By default it's TypedDataTable. You can switch the default in the project settings -> conventions -> LLBLGen Pro Runtime Framework.