I want to read changes within an EntityObject for inclusion in a report.
For example:
Name:
BeforeAfterLocation:
BeforeAfter
Is there a generic way to do this? I’m using EF4 with default entity class generation (not POCO).
These entities will be attached, so they should be being tracked for changes. I cannot see a means to do this via the IEntityWithChangeTracker interface.
Traversing navigation properties would be nice, but it’d be enough of a win to just report upon changed primitive properties.
You can retrieve
ObjectStateEntryfor your entity and check contents ofCurrentValuesandOriginalValues. Try this (untested):This will not handle navigation properties and I’m not sure how it would work with complex types.