Keeping a Change History With LinqToSQL
So in a lot of applications you want to keep track of what your users are doing to your precious data. What was it and what did they change it to? I remember setting up entities with a bunch of isDirty flags or adding to a list in set methods which are all fine but if you’re using LinqToSQL, you’re already covered.
Just before you do a submit changes all you have to do is call GetModifiedMembers on your table object. Like so:
var foo = currentView.db.Accounts.GetModifiedMembers(currentView.EditAccount);
Then you can loop through any and all results to get .Member.Name, or .OriginalValue or .CurrentValue
PS. I realize that you can just do this invisibly by overriding OnChanging classes but if you need to be selective the above is a solid method.