Reputation: 7140
How to know if an object (pulled from some datacontext) got updated during some process or not?
is there any build-in method/prop can do this job, or I must define one (prop, e.g.: Updated) and set it to true every time object got modified?
Upvotes: 1
Views: 161
Reputation: 172646
You can achieve this by querying the GetChangeSet property of the DataContext
class. Here's an example:
object entity;
bool hasChanged = context.GetChangeSet().Updates.Contains(entity);
Upvotes: 3