I use EF & WCF in N-Tier application. I use self tracking entities and I have problem with updates. Example code of my wcf service:
public void UpdateUser(User user)
{
using (var db = new TestModelContainer())
{
db.UserSet.ApplyChanges(user);
db.SaveChanges();
}
}
Example code of my client application:
using (var svc = new ServiceClient())
{
var usr1 = svc.GetUser();
var usr2 = svc.GetUser();
usr1.Name = "Ivan1";
usr2.Email = "Ivan1@mail.com";
svc.UpdateUser(usr1);
svc.UpdateUser(usr2);
}
Result database record don't contain changes of first update. If i use STE, then ChangeTracker known that property changed and EF can partially update record in database. Why don't EF it?
Sorry for my bad English, I am not native speaker.
public void UpdateUser(User user)
{
using (var db = new TestModelContainer())
{
db.UserSet.ApplyChanges(user);
db.SaveChanges();
}
}
Example code of my client application:
using (var svc = new ServiceClient())
{
var usr1 = svc.GetUser();
var usr2 = svc.GetUser();
usr1.Name = "Ivan1";
usr2.Email = "Ivan1@mail.com";
svc.UpdateUser(usr1);
svc.UpdateUser(usr2);
}
Result database record don't contain changes of first update. If i use STE, then ChangeTracker known that property changed and EF can partially update record in database. Why don't EF it?
Sorry for my bad English, I am not native speaker.