Create a many to many relationship in Entity Framework skipping extra data in the link table.

Posted by Paul Smith on Stack Overflow See other posts from Stack Overflow or by Paul Smith
Published on 2010-03-19T09:09:19Z Indexed on 2010/03/19 9:11 UTC
Read the original article Hit count: 393

I would like to model the following many to many relationship.

Table A
ID
Field1
Field2

Table B
ID
Field1
Field2

LinkTable
A_ID
B_ID
Field_I_want_to_ignore

As I understand it, if LinkTable.Field_I_want_to_ignore was not present, the Entity Model Designer would automatically create a Many to Many relationship between entity A and entity B. However, because this field exists in the database the designer won't do it for me.

I can delete the Field_I_want_to_ignore from the LinkTable Entity that the designer created for me, but how do I eliminate the LinkTable entity altogether and create the many to many relationship I want?

I'm not averse to digging through the XML, just at the moment I can't see how to achieve what I want.

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about many-to-many