-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
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));
...
Reactions are currently unavailable