This is a migrated thread and some comments may be shown as answers.

1:n and multiple tables

2 Answers 86 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Adrian Weidermann
Top achievements
Rank 1
Adrian Weidermann asked on 24 Feb 2010, 10:53 PM
I found 2 ways to create 1:n connections. First one creates an index column to the sub table and the second one would create a link table. Both ways work fine as long as you only use a table for like one or 2 other tables. My problem is that i got a table setup like the one below. It uses one table that is connected to a lot of other tables in a 1:n connection.

tbl_Equipment
- IdEquipmentType (PK) <- 10 = tbl_User, 20 = tbl_Car, 30 = tbl_House, 40 = tbl_Pet
- Id (PK) <- Id at the table
- EquipmentName

tbl_User
- Id
.....
tbl_Car
- Id
.....
tbl_House
- Id
.....
tbl_Pet
- Id
.....

Using one of the ways above would either result in x additional tables or x fields added to it, while x is the number of tables connected to it. Is there another way to solve it ?

Best regards,
Adrian

2 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 02 Mar 2010, 03:00 PM
Hi Adrian Weidermann,

If I understood you right, you are having one column that is acting like a foreign key to four other tables. That is not possible to be handled at the moment but it will be possible in the future where you will be able to create inheritance in reverse mapping. These capabilities will be part of the Q1 release where it will be possible for you to place your classes in inheritance hierarchy and make your Equipment class to point to the base class of User, House, Car and Pet. In that case, you will have an extra table where the Id of the User, House, Car and Pet will be stored and the Equipment table will point to that table. That way you will not get any additional fields and only one extra table. This is the only way this complex scenario could be handled, so I hope you can try that out after the Q1 release.

Regards,
Zoran
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Adrian Weidermann
Top achievements
Rank 1
answered on 02 Mar 2010, 03:53 PM
Thanks a lot.

That was exactly the information i were looking for. Well beside the part that i need to wait till Q1 ;)

Best regards,
Adrian
Tags
Development (API, general questions)
Asked by
Adrian Weidermann
Top achievements
Rank 1
Answers by
Zoran
Telerik team
Adrian Weidermann
Top achievements
Rank 1
Share this question
or