Entity Framework + Many-To-Many Inserts + WCF Class Library


  • EF does not include the junction table in the model when representing many-to-many relationships. I understand the logic behind this as objects can do this relationship thus; ObjectA can have a collection of ObjectB and vice versa whereas databases cannot. My example is:

    Entity called EBR and Entity called Warning (in the databas the junction table is EBRWarning).

    I can't figure out how to insert a record into the juction table. In the client-side intellisense, neither object has a property of the other.

    The junction table itself is available i.e. EBRWarning exists as an object but there is no 'Context.Add' method as thre is for other tables that I marked as Editable.

    Friday, June 17, 2011 5:28 PM


  • RIA Services doesn't support Many-To-Many without using The alternative is to add the linking table to the model. The easiest way to do that is to add an additional  non-key field to the linking (aka junction) table before generating your model.

    Saturday, June 18, 2011 12:38 AM

All replies