Collection to a DataTable feature.

Posts   
 
    
netLearner
User
Posts: 150
Joined: 18-Oct-2003
# Posted on: 14-Feb-2004 23:23:47   

Hi Frans,

Collections are really simple and easy, it will be more helpful to have a method which will convert a collection to a DataTable. Just a thought.

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 15-Feb-2004 11:22:25   

You can load a collection as a datatable. GetMultiAsDataTable() is your friend simple_smile (method of the entitycollections in selfservicing, static/shared).

If you need more overloads, let me know.

Frans Bouma | Lead developer LLBLGen Pro
erichar11
User
Posts: 268
Joined: 08-Dec-2003
# Posted on: 15-Feb-2004 11:53:30   

How about for the adaptor model. There is no getmultiasdatatable. Is there something similar.

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 15-Feb-2004 22:11:18   

erichar11 wrote:

How about for the adaptor model. There is no getmultiasdatatable. Is there something similar.

No there isn't in the adapter model. I'll add that. simple_smile

Frans Bouma | Lead developer LLBLGen Pro
free4all
User
Posts: 35
Joined: 12-Sep-2003
# Posted on: 29-Apr-2004 13:48:48   

Hi Frans just found a need for the GetMultiAsDataTable() feature in the adapter model this morning has it been implemented yet?

Cheers

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 29-Apr-2004 14:10:49   

It turned out, there is already a feature for that simple_smile FetchTypedList simple_smile . Just do something like this:

CustomerEntity c = new CustomerEntity(); DataTable customers = new DataTable(); DataAccessAdapter adapter = new DataAccessAdapter(); adapter.FetchTypedList(c.Fields, customers, null);

If you want to filter, then pass a RelationPredicateBucket object instead of null simple_smile

Frans Bouma | Lead developer LLBLGen Pro
wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 03-Jun-2004 14:31:54   

I just regen the DAL - There is no GetMultiAsDatatable in my Selfserv collections?

What version of LLBLGen is that in - I use 1.0.2003 Final April 30?confused

I must be missing something.confused

EmployeesCollection Employees = new EmployeesCollection();
Employees.??????????

Only have the following:

Employees.GetMulti Employees.GetMultiManyToManyUsingCustomersEntitiesForOrders Employees.GetMultiManyToManyUsingShipViaShippersEntitiesForOrders Employees.GetMultiManyToManyUsingTerritoriesEntitiesForEmployeeTerritories Employees.GetMultiManyToOne

I am doing an example on how to implement a BL with LLBLGen - using Northwind database. - Had a few requests.simple_smile - Not enough hours in a day!

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 03-Jun-2004 14:32:20   

Still can't find it.confused

Downloaded the latest Tempates & Tasperformers for SQLServer and C# (Templates_SqlServer_04302004.zip, Taskperformers_SD_04302004.zip) - Just incase i was missing an updatewink - GetMultiAsDatatable does not exist in the templates?

Am i going MAD? confused - Must be missing something else...

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 03-Jun-2004 14:59:19   

Found it!simple_smile - knew i saw it before.

The Key =

It's a static method,

Not like

EmployeesCollection Employees = new EmployeesCollection();
Employees.GetMultiAsDatatable

but like

EmployeesCollection.GetMultiAsDatatable
wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 09-Jun-2004 10:07:10   

Is it possible to return a DataReader?

Is DataTables used internally in the collections?

I have heard rumours that DataTables are very memmory hungry - wont it be better then to rather use a datareader?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 09-Jun-2004 11:22:08   

wayne wrote:

Is it possible to return a DataReader?

Is DataTables used internally in the collections?

I have heard rumours that DataTables are very memmory hungry - wont it be better then to rather use a datareader?

Collections are filled with objects which are filled by a datareader simple_smile It is not possible to return a datareader, nor do I think that's very wise, as the datareader is a very low level object.

Frans Bouma | Lead developer LLBLGen Pro
wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 09-Jun-2004 12:49:29   

Collections are filled with objects which are filled by a datareader

Are theses objects created and filled as they are resquested? - like load on demand? Or are they just all created when the collection getmulti is called?

The reason that i am asking is because we have noticed that our collections are very memory hungry. A load on demand for collection's would be nice.

Edit - yep sometimes our collection retreives every record - BAD BAD I know.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39826
Joined: 17-Aug-2003
# Posted on: 09-Jun-2004 12:51:25   

wayne wrote:

Collections are filled with objects which are filled by a datareader

Are theses objects created and filled as they are resquested? - like load on demand? Or are they just all created when the collection getmulti is called?

The reason that i am asking is because we have noticed that our collections are very memory hungry. A load on demand for collection's would be nice.

When you request 100 entities from the db, you will get 100 objects: each row read by the datareader will end up as an entity object.

So if you don't need all objects, specify a tighter filter to fetch less.

Frans Bouma | Lead developer LLBLGen Pro
jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 09-Jun-2004 20:14:17   

wayne wrote:

I have heard rumours that DataTables are very memmory hungry - wont it be better then to rather use a datareader?

DataReaders leave the connection open as well until it's destroyed, and they're forward only i.e. they're not very portable.