views:

97

answers:

1

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.

+1  A: 

IMHO the simplest way is this:

  1. Back up your DB.
  2. Restore the DB elsewhere.
  3. Drop the field.
  4. Generate a model.

The new model will work just fine with the "real" DB.

Yes, it's possible to do this by digging through XML/EDMX, but it's complicated, as it changes CSDL, MSL, and SSDL.

Whereas the steps above can be done in a script.

Craig Stuntz
Interesting idea - I'll give it a go. As is always the case, something more urgent has come up so it might be a while before I can verify the result.Thanks!
Paul Smith