I I have a linq-to-sql database in which I want to log some of the changes made to an entity. Right now, I'm getting the updated entities by reading the DataContext.GetChangeSet().Updates property, but that doesn't provide me with the fields from the entity that were changed.
Is there a way to know which fields were modified in an updated entity??
Thanks
The DataTable has a method GetModifiedMembers that will return a list of members that have changed for a specified entity instance.
DataClasses1DataContext context;
Class1 instance = context.GetChangeSet().Updates.OfType<Class1>().First();
context.Class1s.GetModifiedMembers(instance);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With