I have two tables th开发者_Go百科at are connected via a join table in a many-to-many relationship in the Entity Framework. I need to add a composite primary key in the join table for the two columns that are related to the joined tables via standard foreign keys but I'm sure how to do that.
If your join table has a composite key on both foreign keys, the Entity Framework designer in VS2008/2010 should pick up on that.
SQL:
CREATE TABLE MyTable
(
ColumnFK1 int,
ColumnFK2 int
PRIMARY KEY (ColumnFK1, ColumnFK2)
)
If the table is already created you can modify the primary key in Management Studio.
精彩评论