Generating class from two tables

Posts   
 
    
ushah
User
Posts: 3
Joined: 20-Jun-2009
# Posted on: 20-Jun-2009 00:08:57   

We have legacy db. Our Receipts entity is split in two tables. Receipts and ReceiptLineItems. Can I generate one entity in code from two tables?

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 20-Jun-2009 01:36:49   

Hi Ushah,

Is this a one-to-many or a one-to-one relationship?

Ryan

ushah
User
Posts: 3
Joined: 20-Jun-2009
# Posted on: 22-Jun-2009 16:17:45   

It is one to one relationship

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 22-Jun-2009 16:53:46   

Hi Ushah,

Many times what I do in one-to-one relationships is:

1.) Make sure there is a relationship in the DB between the two Primary Keys of the two tables.

2.) In the LLBLGen Designer, assign Fields on Related Fields. This way, your Entity in Table 1, can have Read/Write properties for columns belonging to the Entity for Table 2. Using this method, you could use one Entity for both Tables.

Hope this helps!

Ryan

PS. You can also access the other entity by doing: myReceiptLineItem = myReceipt.ReceiptLineItems