views:

189

answers:

0

I've got a set of LINQ-to-SQL entities which I've mapped to a view model. In this application a repository project is responsible for retrieving and storing view model objects. (So the entities are 'disconnected', new LTS entities are created from the specified view model objects and a DataContext is created per-request.)

I've got a many-to-many relationship which is represented in the view model as an list of integers (the PK ID's of the foreign table), the mapper translates these into the EntitySet on the primary table when an update request is made. When I attach the entity to the data context this EntitySet is ignored.

I can easily attach, insert, and/or delete records in the middle entity table manualy to effect the update within the repository. My question is, is this the correct way to do this? Is there a way to tell LTS to update this EntitySet automatically?