Reading all records

Posts   
 
    
he00273
User
Posts: 133
Joined: 02-Oct-2008
# Posted on: 03-Mar-2009 02:03:13   

(Please note the subject should be Reading not Readong)

I want to be able to read all records in a database table, that is one entity at a time.

Using ADO.NET I simply use a DataReader to do this. I need to sort the records but once sorted, I simply need to process all the records in a forward direction only. No deletes, no updates or inserts.

Can LLBLGen Pro do this efficently or should I stick to ADO.NET for this task.

Currently my data source is an Access database but this is scheduled to be ported to SQL Server. I know that LLBLGen pro is good at insulating one from the actual database that is being accessed, so I am keen to use it here but I am not sure how one would do this efficiently or if one should use self-service as apposed to Adaptor to take advantage fo lazy loading.

I will stick to using ADO.NET for now as this is very familar. If I can gain some real advantage with using LLBLGen Pro in this way I will switch over.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Mar-2009 03:36:08   

I think you will find this manual section very useful in your scenario. And for the Adapter vs. SelfServicing, please take a look at this.

David Elizondo | LLBLGen Support Team
he00273
User
Posts: 133
Joined: 02-Oct-2008
# Posted on: 03-Mar-2009 07:42:48   

Thanks that looks good.

How does one sort the data as apposed to filtering it via a RelationPredicateBucket?

Also if one is processing say 2,000,000 rows (entities) how can abort/cancel the operation after processing n records.

As I need to access MS Access (not that I really want to) as well as SQL Server I am fairly sure that Access does not support stored procedures natively. In your documentation you state

The first option, the IRetrievalQuery option, can be used to fetch a retrieval stored procedure as an open IDataReader, by using the RetrievalProcedures.GetStoredProcedureNameCallAsQuery() method of the particular stored procedure call

Currently I have been able to switch between Access and SQLServer using the DbProviderFactory. This enables me to switch between different databases (provided I take into account any differences in SQL where its needed).

I know I can use llblgen Pro to access Access and then build another set of classes to access SQL Server (or whatever else is supported). How does one enable one to switch between them smoothly at run time (i.e. have both sets of entity classes present as the table is essentially identical and have the same name, they just exist in different databases.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 03-Mar-2009 09:14:17   

How does one sort the data as apposed to filtering it via a RelationPredicateBucket?

There is an overload for the FetchDataReader which accepts an ISortException parameter.

Also if one is processing say 2,000,000 rows (entities) how can abort/cancel the operation after processing n records.

Just close the dataReader.

As I need to access MS Access (not that I really want to) as well as SQL Server I am fairly sure that Access does not support stored procedures natively. In your documentation you state

You should fetch a dynamicList as an IDataReader. As opposed to an SP.

Currently I have been able to switch between Access and SQLServer using the DbProviderFactory. This enables me to switch between different databases (provided I take into account any differences in SQL where its needed).

I know I can use llblgen Pro to access Access and then build another set of classes to access SQL Server (or whatever else is supported). How does one enable one to switch between them smoothly at run time (i.e. have both sets of entity classes present as the table is essentially identical and have the same name, they just exist in different databases.

This has been discussed several times before. Please check these threads: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=12337 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14781 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=14176 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=13416

he00273
User
Posts: 133
Joined: 02-Oct-2008
# Posted on: 05-Mar-2009 01:07:40   

Ok Thanks