I’ve got a setup similar to this:
Table1
id1 (int)
name (varchar)
Table 2
id2 (int)
name (varchar)
Bridge
id1 (fk to Table1)
id2 (fk to Table2)
As you all know, in the EF, an object won’t exist to represent Bridge. Instead, Table1 will contain a collection of Table2’s and Table2 will contain a collection of Table1’s.
Let’s say I have a single Table1 record associated with 5 Table2’s.
How do I delete all Table2 references efficiently? I only want them deleted from the Bridge table…
I think you just clear the references and then save the changes – I don’t think it deletes the Table2 records, but I may be wrong: