none
Create association (link) between two tables (primary/foreign key association) RRS feed

  • Question

  • For the most part when I create a .dbml file and add LINQ classes associated with tables in my database as I drag the table from the server explorer in the VS IDE it "automatically" creates an association. I can see the link between the table automatically created. But in some cases I have two tables and no link is established. I see the two tables in the visual representation in the IDE (.dbml) but there is not the "link" between the keys that I was hoping for. From the IDE how do I create the equivalent of a foreign key assication between tables for a LINQ class?

    Thank you for your suggestions.

    Kevin
    Friday, May 15, 2009 2:04 PM

Answers

  • It will create the associations automatically if there is a foreign key constraint on the server.

    If there is not then you can manually create one by right-clicking on the designer surface and choosing Add > Association from the context menu.

    [)amien
    • Marked as answer by KevinBurton Friday, May 15, 2009 3:24 PM
    Friday, May 15, 2009 3:21 PM
    Moderator