3

I have junction tables all over my database so that I can create many to many relationships. In one case, I have tables NotificationFormat and Frequency and connect them with a junction called NotificationFormatFrequency.

I have tried to add the junction table to the list of Entity Types, but I have not found a way. 'Update Model from Database...' does not add the junction table to the list of Entity Types, but I do see it in the Entity Store.

After much trial and failure, I looked through and noticed that none of my purely junction tables show in the diagram, nor are they available in the Entity Types to be added to the Diagram. However, in each case I see an 'Association' between my two tables, and I even see a collection of NotificationFormats connected to a collection of Frequencys.

So, expected behavior for modeling many to many relationships in EF? If so, then perhaps I don't want to clutter my diagram with the junction tables, and so maybe I don't care if there's a way to do it. Thanks in advance.

jacoblambert
  • 787
  • 1
  • 11
  • 18

1 Answers1

2

Yes, EF will create intermediate tables for you. For a given relationship, just have both ends use a cardinality of > 1 (*, 1...*).

You won't see the intermediate tables as types or in the designer, but they will appear in the actual DB.

BradleyDotNET
  • 60,462
  • 10
  • 96
  • 117