IT:AD:EF:Concepts:State Tracking
Summary
It's really not that complicated:
Every tracked (attached) object is shadowed with an EntityStateEntry that as it loads, copy's the entities values into an OriginalValues collection, and sets its State as Unmodified.
Any changes sets the flag to Modified.
When A Commit happens, all Modified entries are sent off to be saved.
If the Commit causes AcceptsAllChanges, it sets all the Original values to the Current values (no turning back from that point).