How do I save an object that contains and EntitySet?

Posted by Pete on Stack Overflow See other posts from Stack Overflow or by Pete
Published on 2010-03-29T15:25:14Z Indexed on 2010/03/29 17:53 UTC
Read the original article Hit count: 320

Filed under:
|

Say I have an User (mapped to a User table) and the Edit view (in MVC) displays a multiselectlist of Modules (mapped to a Modules table) that user can access, with the Modules pre-selected based on the User's EntitySet of Modules.

I have tried saving the User then deleting all User_Modules manually and adding them back based on what's selected on submit, but the User has a null EntitySet for User.User_Modules.

I cannot find the correct way to handle this scenario anywhere online. Can anyone help?

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about LINQ