Entity framework 4, update specific properties
I'm used to using code first where I can do:
db.Users.Attach(user)开发者_开发技巧;
db.Entry(user).Property(propertyName).IsModified = true;
How do I do this with a DataModel approach?
I do not have the Entry
method on my datacontext.
Use:
context.Users.Attach(user);
ObjectStateEntry entry = context.ObjectStateManager.GetObjectStateEntry(user);
entry.SetModifiedProperty(propertyName);
精彩评论