开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜