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
  • 56,733
  • 95
  • 279
  • 406

1 Answers1

0

Use:

context.Users.Attach(user);
ObjectStateEntry entry = context.ObjectStateManager.GetObjectStateEntry(user);
entry.SetModifiedProperty(propertyName);
Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670