I asked this question earlier but I think I phrased it incorrectly, so here is attempt number two. I have the following code:
public User EditUser(User userToEdit)
{
//userToEdit contains values for eagerly loaded contacts entity
User originalUser = (from u in _entities.UserSet.Include("contacts")
where u.ID == userToEdit.ID
select u).FirstOrDefault();
_entities.ApplyPropertyChanges(originalUser.EntityKey.EntitySetName, userToEdit);
_entities.SaveChanges();
return userToEdit;
}
Pretty straight forward. However, the contacts entity isn't updated. To my understanding eager loading adds the entity to the data context so when ApplyPropertyChanges is called with the detached userToEdit, the changes to contacts in userToEdit will by applied to the attached contacts entity. What am I missing?