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?
Edit: adding my EntitySet code
private EntitySet<UserModule> _UserModules;
[Association(Storage = "_UserModules", ThisKey="UserId", OtherKey = "UserId")]
public EntitySet<UserModule> UserModules
{
get { return this._UserModules; }
set { this._UserModules.Assign(value); }
}