Data navigation and prefetch path in databinding

Posts   
 
    
DanyWu
User
Posts: 6
Joined: 12-Jul-2005
# Posted on: 06-Aug-2005 06:53:09   

Hi folks,

I'm a complete newbie in using this tool. Basically I am trying to have three datagrids, one each for Customers, Orders, and OrderDetails. When I was using datasets with relationships between the tables within I was able to populate bind to the datagrids and navigate through them without trapping events or using currencymanagers.

Here's my code in attempt to replicate this with the generated code:

        private void Form1_Load(object sender, System.EventArgs e)
        {
            //Embarassingly stupid bits of code deleted (phew!)
                                                //Repeat after me..."I did not see anything!"
        }

I successfully did it with Customers and Orders, i.e. selecting a different row in dgCustomers automatically bring up the relevant Order entities. It didn't work for Orders and OrderDetails though.

I have to admit I'm not sure what I'm doing here simple_smile Any help would be immensely appreciated.

Cheers, Dany.

DanyWu
User
Posts: 6
Joined: 12-Jul-2005
# Posted on: 06-Aug-2005 08:05:56   

Ahem....nevermind....I figured it out. Please ignore all that embarassingly stupid bunch of code confused

I didn't realise you can bind datasource to "Customers" and datamember to "Orders.OrderDetails".

This raises another question actually. How deep can the prefetch thing work? I presume the appropriate EntityCollections must be defined in the generated code for the subpaths to work?

D.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 06-Aug-2005 11:13:57   

DanyWu wrote:

Ahem....nevermind....I figured it out. Please ignore all that embarassingly stupid bunch of code confused

You can edit it, if you'd like simple_smile

This raises another question actually. How deep can the prefetch thing work? I presume the appropriate EntityCollections must be defined in the generated code for the subpaths to work? D.

Yes, but that's the case in most situations. The more levels you add to a prefetch path, the more queries will be executed of course. Each level adds a subquery level, so the limit is 32 levels deep. Though I think with 32 levels deep you have your complete database in memory as wellwink

Frans Bouma | Lead developer LLBLGen Pro