public StateMachineSafeExecutor(
            IStateMachineExecutor <TState> realExecutor,
            Action <Exception>?handler)
        {
            _realExecutor = realExecutor.ThrowIfNull(nameof(realExecutor));

            _handler = handler ?? (ex => Logger.Exception(ex));
        }
예제 #2
0
        public static TState Execute <TState, TStateId>(
            this IStateMachineExecutor <TState, TStateId> executor)
            where TState : class
        {
            executor.ThrowIfNull(nameof(executor));

            using (var enumerator = executor.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    // All actions perform in MoveNext.
                }
            }

            return(executor.State);
        }