Sidecars 7, Brazil 0...

Sidecars 7, Brazil 0... (Propagate generated principal values to FKs on SaveChanges)

Some primary/principal key values are generated in the store when the entity is saved--for example, for Identity columns. These values are written back into the state entry by the update pipeline. Foreign keys that reference these principal key values also need to be updated with the generated values so that the entire graph stays in sync and so that subsequent commands issued by the update pipeline make use of the newly generated values. Also, if the save transaction is not committed, then these generated values should be discarded.

Values written into the state manager by the update pipeline are placed in a temporary transparent sidecar so that they can be discarded later. When a change is detected (or notification is made) that a principal property has changed, then the state manager now finds dependents and updates FK values appropriately. These are also written into the transparent sidecar so that the update pipeline can read them like normal values for subsequent commands, but the values can still be discarded if SaveChanges fails.

Still working on some tests.
If the principal key is null wouldn't this return all 'dependents' that have a null foreign key?