title: Fully automatic dirty flag (for all members of a class) in C#
body: <p>We want to keep track of all the changes made in a class so we can later update only the delta to our database, and I was wondering what's the best way to do it.</p>
  
  <p>Our only constraint is that need to keep track of objects only <strong>after</strong> they have been loaded and populated from the database, and I want to keep the data objects as simple as possible (and we'd rather put more stress on the API layer, rather than on our database layer).</p>
  
  <p>In a previous project, we've implemented the <code>INotifyPropertyChanged</code> interface (of sorts), but this required to manually track every property in our class and added a lot of manual development overhead, and it greatly inflated our data objects.</p>
  
  <p>I was thinking of implementing a fully automatic solution, which all of our objects can inherit from, and once we tell the object to "begin tracking changes", it will perform a deep copy of the object using reflection - to be later compared when we "end tracking changes", which should output only the deltas in the object.</p>
  
  <p>--</p>
  
  <p>So I was hoping to get some thoughts on my idea, or if anyone can think of a better solution.</p>