How can I update an entity without having to make a call to select it. If I supply the key for the entity, should it not know to update after SaveChanges() is called on the ObjectContext.
I currently do this:
var user = context.Users.Single(u => u.Id == 2);
user.Username = "user.name";
user.Name = "ABC 123";
context.SaveChanges();
That works, but forces a select. Because I know the Id
, why can't I do something like this:
var user = new User();
user.Id = 2;
user.Username = "user.name";
user.Name = "ABC 123";
context.UpdateObject(user);
context.SaveChanges();
Thanks in advance.
EDIT: Also, it's important that only the affected properties that are changed be updated. Is this possible?