0

我不熟悉使用无状态并试图确保我理解保护条款的目的。我能够创建一个状态机,但我想基本上检查进入年龄 > 12 && 父权限存在的状态。我是否正确理解了 Guard 条款,如果是,我将如何实施这样的条款?

    var stateMachine = new StateMachine<State, Trigger>(State.EnrollmentCompleted);

    stateMachine.Configure(State.EnrollmentCompleted)
                .Permit(Trigger.EnrollmentCompleted,ValidatingEnrollment, ***Guardclause to check if user age > 12 and Parentpermission=true***);

    return stateMachine;
4

1 回答 1

1

GitHub 页面上有关于 Guard 条款的信息。在此基础上,它似乎只是......

stateMachine.Configure(State.EnrollmentCompleted)
            .Permit(Trigger.EnrollmentCompleted,ValidatingEnrollment, () => userAge > 12 && parentpermission);
于 2017-11-02T02:36:04.920 回答