New Posts New Posts RSS Feed: Multiple table references
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Multiple table references

 Post Reply Post Reply
Author
wackywhizz View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Aug-2011
Location: Philippines
Posts: 8
Post Options Post Options   Quote wackywhizz Quote  Post ReplyReply Direct Link To This Post Topic: Multiple table references
    Posted: 20-Dec-2011 at 12:48am
Hi there,

I have a table whose 1 column is supposedly a foreign key from multiple tables.. This is my scenario. I have a 'tblTransactionTaxes' table which has an 'intReferenceID' foreign column. Then I have several transactional tables such as tblBills, tblInvoice, etc.. all of which has an intTransactionID column that i'd like to map to the intReferenceID column on tblTransactionTaxes. I'm having a lot of difficutlies on this. How should I handle these instances on my model using DevForce?

Thanks,
Lawrence
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 20-Dec-2011 at 11:41am
Hi Lawrence,
What exactly is the issue you are coming across?
Maybe having a base class for tblBills, tblInvoice, etc. where intTransactionID would be. (i.e. in case you want tblTransactionTaxes to reference only one entity)
Silvio.
Back to Top
wackywhizz View Drop Down
Newbie
Newbie
Avatar

Joined: 25-Aug-2011
Location: Philippines
Posts: 8
Post Options Post Options   Quote wackywhizz Quote  Post ReplyReply Direct Link To This Post Posted: 20-Dec-2011 at 7:39pm
Hi Silvio,

It's not actually an issue but more of a question.. We're currently normalizing our db and we've found difficulties controlling them in EF/DevForce, so what I was asking is if there could be a better approach on our scenarios, whether it be change our schema or handle things in DevForce. I've list down our scenarios below..


- A single table with multiple associations to another table. Say we have a tblBills and tblBillDetails. The first association is the intBillID which is taken automatically. The second one is a 'strOriginalBillNumber' field on tblBills that is associated to tblBillDetails' 'strOriginalNumber' field. We're having problems as to how to associate multiple fields between tables..

- A single column within a table with an association to multiple tables. This is what I was asking on my earlier post. We record all transaction taxes on 'tblTransactionTaxes' that was created from different types of transactions. Different transactions records lie on different tables (tblBills, tblOrders, tblInvoices, etc..) We have a column (intTransactionID) in tblTransactionTaxes that we'd like to link on these tables. Together with another column (strTransactionType) we'd like to link them up on these several tables.


Thanks,
Lawrence
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 21-Dec-2011 at 2:28pm
Lawrence,
 
Regarding the first item, do you want to have two associations between tblBills and tblBillDetails?
The First association appears to be a clear one-to-many association (as in Orders_OrderDetails in NorthwindIB) and there shouldn't be issues there.
The second association is not clear to me. I'm not familiar with your business logic, and can't think of a case for a second relation either.
 
For the second item, I still think that my suggestion is still valid (i.e. having a base class for tblBills, tblInvoice, etc. where intTransactionID would be located.
 
Silvio.


Edited by sbelini - 21-Dec-2011 at 2:36pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down