I have a project where I am using EFv4 to save data back to my repository. This is working as expected for the simple properties on my object but does nothing for the related objects.
For example, I have a User object and a related property Roles that is a collection of Role entities.
If I update the User's lastActivity date and the Roles assigned to the user in my UI and then send the User object back to the repository to be updated I can see the new values in the User object for both lastActivity and the Roles, but when I call:
this.ObjectContext.ApplyCurrentValues(entitySet.Name.ToString(), entity);
this.ObjectContext.SaveChanges();
only the simple properties are saved like the lastActivity date, the Role changes are ignored.
Do I need to do something special update all referenced objects?
UPDATE: I was searching the web a bit more and saw that someone mentioned that ApplyCurrentValues only affects the scalar properties. Still doesn't change my original question, but it could explain why the related entities are not being updated. Microsoft's documentation makes not mention of this from what I can see.