Update only modified properties

Jan 7, 2014 at 12:32 PM
Thanks for the code, it really helps as there are so many different ways of implementing this out there.
I've used this code to implement unit of work with EF5, with certain modifications. Can you throw some advice on how to:
  1. Is it possible to make a change so that only modified fields are updated. I've seen that it works fine when you are working on a single context, but not when you set EntityState and Attach the object. Is iterating through the properties one by one, my only choice?
  2. If I need to implement auditing of changed fields (with each table having a corresponding History table with nullable fields), what is a good way, other than, again, iterating through all properties and Inserting an additional History object?
Jan 28, 2014 at 7:11 PM
In short, from what I have found on my previous search for the answer to this question is once it is detached and reattached you lose the self-tracking ability which means you have to spin through the property and check the original db value.

I found this article after a brief search.
Marked as answer by lelong37 on 3/31/2014 at 10:39 PM