0

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.

Shawn Mclean
  • 55,505
  • 94
  • 274
  • 404

1 Answers1

0

Use:

context.Users.Attach(user);
ObjectStateEntry entry = context.ObjectStateManager.GetObjectStateEntry(user);
entry.SetModifiedProperty(propertyName);
Ladislav Mrnka
  • 355,666
  • 57
  • 651
  • 662