Found a bug in EntityGraph:
I have a parent-child entity relation and use "Composition" attribute. When the child entity get some change, the parent entity gets the "HasChange" attribute (as expected).
Then if you try to use the entity.ExtractState(RiaServicesContrib.ExtractType.OriginalState) you get a null reference exception.
I downloaded the source code of EntityGraph and debug, and find the following in the ExtractState method:
if (extractType == ExtractType.OriginalState && entity.HasChanges)
extractEntity = entity.GetOriginal();
extractEntity = entity;
so as "HasChanges" is true for the parent it's processed the "true" branch and extractEntity gets "null" from GetOriginal(). Couple of lines down the code throws an exception.
Hope this help.