Databinding Prefetched Data

Posts   
 
    
keeper7k
User
Posts: 5
Joined: 01-Nov-2005
# Posted on: 30-Aug-2006 10:36:01   

I'm using LLBL version 1.0.2005.1 (Adapter scenario) and i'm having a schema like this : - Customers - Orders (detail m:1 to Customers)

I fetch a collection of customers, with prefetched orders, based on criteria from both tables.

What i'm trying to do is databind a control (Repeater) to the Orders (Prefetched Data), and also have access to the columns of the parent table.

Is this possible? Thanks in advance

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 30-Aug-2006 15:35:10   

Like if you want to display the customerName for instance with each row of the orders table. You should use the LLBLGen Pro designer to add an extra field to the OrderEntity; "a field mapped on related field" and map it to Customer.Name

Then with the help of the prefetchPathing that you were using, this field gets loaded. And you can display it in your grid as well.

Insane
User
Posts: 10
Joined: 19-Sep-2006
# Posted on: 19-Sep-2006 16:20:51   

I read this thread and helped much. Thanks.

I think customerName comes with all instances of OrderEntity. Is there a way that I can specify that I don't need customerName for current instance or do I make a new entity without the customerName column. (for the sake of performance)

My scenario is; 1. Bind all related tables into a grid and display. 2. Allow editing of this grid. 3. Save changes to DB.

In another scenario I may not want to use customerName column.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 19-Sep-2006 17:13:53   

Hi

I think adding a field to the entity class assumes you want to use it all the time.

If not, why not making a view with corresponding entity or a typedlist or even play with the databound event with a standard parent entity-child entitycollection for your particular scenario?

Insane
User
Posts: 10
Joined: 19-Sep-2006
# Posted on: 20-Sep-2006 14:00:32   

Projections really worked fine thanks. Now I am trying to figure out the differences between serialization of IList & Projections. I'm going to do some performance tests.

Thanks for support.