Many-to-many mapping

Dec 21, 2009 at 11:41 PM

I'm working on a mapping which will support many-to-many relationships, and @mattwar's blog post http://blogs.msdn.com/mattwar/archive/2009/04/08/building-a-linq-iqueryable-provider-part-xiv-iqtoolkit-v3.aspx, the following is mused about:

Yet how do you make an explicit update to the link table that you don't have an entity directly mapped to?  I need to ponder this some more.  Possibly if one side of the relationship is a composition as opposed to an association, then it would be implied when that side is updated.  Yet what if you chose not to load the relationship, how do you tell the system to not delete all previous relationships?

For relationship modifications (updates), I'm currently working with the notion of rewriting the expression to deal only with additions and removals. For additions and removals, I'm just adding a new concept of a MappingAssociation to model what needs to be inserted or deleted.

I'm not clear about the scenarios in which removals would not have loaded some part of the relationship so the user could select which relationships needing removal. Does someone have insight into this?