public StateMachineWithRollbackEnumerator( IStateMachineEnumerator <TContext, TStateId, TStatefulTaskWithRollback> realEnumerator, bool continueRollbackOnFailed) { _realEnumerator = realEnumerator.ThrowIfNull(nameof(realEnumerator)); _rollbackScope = new RollbackScope <TContext>( continueRollbackOnFailed, realEnumerator.Context ); }
public static void RunSimpleSample() { var actionOne = new SimpleRollbackActionOne(); var actionTwo = new SimpleRollbackActionTwo(); using var scope = new RollbackScope <int>( continueRollbackOnFailed: true, rollbackParameter: 42 ); scope.Add(actionOne); scope.Add(actionTwo); scope.TryRollbackSafe(); }