Fetch a query as a datareader?

Posts   
 
    
Posts: 497
Joined: 08-Apr-2004
# Posted on: 08-May-2006 17:31:41   

Hi,

This beta looks jam-packed with new stuff simple_smile I'm just starting to evaluate it, and look through the list of new stuff. I noticed this new feature:

It's now possible to fetch a query as a datareader. This query can be a stored procedure call, or a query created on the fly by the DQE used. This datareader can then be used further, if required, to project the data onto classes like entity classes, datatables or custom classes using the generic data-projection framework.

Can you elaborate a little on what you mean here. Are you saying that its possible to create queries on the fly with SQL-like text, or have I got the wrong end of the stick there?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39928
Joined: 17-Aug-2003
# Posted on: 08-May-2006 17:45:44   

MattWoberts wrote:

Hi,

This beta looks jam-packed with new stuff simple_smile I'm just starting to evaluate it, and look through the list of new stuff. I noticed this new feature:

It's now possible to fetch a query as a datareader. This query can be a stored procedure call, or a query created on the fly by the DQE used. This datareader can then be used further, if required, to project the data onto classes like entity classes, datatables or custom classes using the generic data-projection framework.

Can you elaborate a little on what you mean here. Are you saying that its possible to create queries on the fly with SQL-like text, or have I got the wrong end of the stick there?

You can do that indeed. If you want to go very close to the metal, you can construct your own RetrievalQuery object, which contains a command object which you then fill with a query text. You don't have to go that deep to use the feature though simple_smile You can produce queries using entityfields(2) objects, similar to dynamic lists, or if you want to call a retrieval proc, use the method generated for the proc which produces the IRetrievalQuery object. simple_smile

Frans Bouma | Lead developer LLBLGen Pro