1:n and multiple tables

3 posts, 0 answers
  1. Adrian Weidermann
    Adrian Weidermann avatar
    7 posts
    Member since:
    Nov 2009

    Posted 24 Feb 2010 Link to this post

    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. Zoran
    Admin
    Zoran avatar
    534 posts

    Posted 02 Mar 2010 Link to this post

    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.
  3. DevCraft banner
  4. Adrian Weidermann
    Adrian Weidermann avatar
    7 posts
    Member since:
    Nov 2009

    Posted 02 Mar 2010 Link to this post

    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
Back to Top