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?开发者_运维知识库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);
I think you should check property
my_object.EntityState
http://msdn.microsoft.com/en-us/library/system.data.objects.dataclasses.entityobject.entitystate.aspx
精彩评论