I am writing a generic repository to be used for my every model CRUD operation using entity framework CTP5 as following:
public class BaseRepository
You can use CurrentValues.SetValues:
CurrentValues.SetValues
public void Update(TEntity entity) { TEntity status = Context.Set().Find(entity.Id); Context.Entry(status).CurrentValues.SetValues(entity); Context.SaveChanges(); }
It updates scalar and complex properties but not navigation properties.