I am trying to update a detached POCO w/ EF 4 CTP 4.
My domain class looks like this:
public class User {
public int Id { get; set; }
[Required, DisplayName("First Name")]
public string FirstName { get; set; }
[Required, DisplayName("Last Name")]
public string LastName { get; set; }
[ConcurrencyCheckAttribute, Timestamp]
public byte[] DataVersion { get; set; }
}
In the repository I have the following:
public void SaveUser(User user) {
if (user.Id > 0) {
dbContext.Users.Attach(user);
}
else {
dbContext.Users.Add(user);
}
dbContext.SaveChanges();
}
dbContext inherits from DbContext.
I am able to do inserts fine, but the attach doesn't work. I run Sql Profiler, and no sql is sent for the update.