Print Page | Close Window

Multiple table references

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3171
Printed Date: 13-May-2026 at 4:08pm


Topic: Multiple table references
Posted By: wackywhizz
Subject: Multiple table references
Date 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



Replies:
Posted By: sbelini
Date 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.


Posted By: wackywhizz
Date 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


Posted By: sbelini
Date 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.



Print Page | Close Window