private void CopyComplete() { Assumes.NotNull(_outerAtomicComposition); _outerAtomicComposition.ContainsInnerAtomicComposition = false; // Inner scopes are much odder, because completeting them means coalescing them into the // outer scope - the complete or revert actions are deferred until the outermost scope completes // or any intermediate rolls back if (_completeActionList != null) { foreach (Action action in _completeActionList) { _outerAtomicComposition.AddCompleteAction(action); } } if (_revertActionList != null) { foreach (Action action in _revertActionList) { _outerAtomicComposition.AddRevertAction(action); } } // We can copy over existing atomicComposition entries because they're either already chained or // overwrite by design and can now be completed or rolled back together for (var index = 0; index < _valueCount; index++) { _outerAtomicComposition.SetValueInternal( _values[index].Key, _values[index].Value); } }