Skip to content

PermitIf error message #28

@PaulVipond

Description

@PaulVipond

Hi Prasanna,

I'm getting the following error message from my _machineConfig.ForState() statement below when I run it:

"Permit* and Ignore* methods are exclusive to each other for a given resulting state."

I'm not quite sure how to interpret it. Does this mean that you can't have multiple PermitIf statements referring to the same parameterized trigger for the same state? In the example below, I'm reusing the same parameterized trigger using guard clauses to get from one state to 3 different states.

If you have the time, I'd appreciate some examples for PermitIf in the readme / sample to clarify thanks.

        private AwaitableConfiguration<AccountStateType, AccountStateTrigger> _machineConfig;

        private ParameterizedTrigger<AccountStateTrigger, RegistrationRequest> _registrationTrigger;

        public AccountStateMachine()
        {
            _machineConfig = StateMachineFactory.CreateAwaitableConfiguration<AccountStateType, AccountStateTrigger>();

            _registrationTrigger = _machineConfig.SetTriggerParameter<RegistrationRequest>(AccountStateTrigger.RegisterAccount);

            _machineConfig.ForState(AccountStateType.Unregistered)
                .PermitIf(async () => await stateCheck_registrationsSuspended(), _registrationTrigger, AccountStateType.AwaitingSiteRegistrationsTurnedOn, async request => await stateFired_AwaitingSiteRegistrationsTurnedOn(request))
                .PermitIf(async () => !(await stateCheck_registrationsSuspended()) && await stateCheck_paidRegistrations(), _registrationTrigger, AccountStateType.AwaitingPayment, async request => await stateFired_AwaitingPayment(request))
                .PermitIf(async () => !(await stateCheck_registrationsSuspended()) && !(await stateCheck_paidRegistrations()), _registrationTrigger, AccountStateType.AwaitingVerification, async request => await stateFired_AwaitingVerification_viaRegistration(request));
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions