public void Execute() { if (!_buildActions.Any()) { return; } PushGeneralBuildAction(BuildActionOrder.PredefinedConditions, () => { IValidator inner = ActionArgs.Pop(); IValidator conditional = new ConditionalValidator( new ValidationTargetCondition(Path), inner ); ActionArgs.Push(conditional); }); IEnumerable <Stack <Action> > orderedActions = _buildActions .OrderBy(x => x.Key) .Select(x => x.Value); foreach (Stack <Action> actions in orderedActions) { while (actions.Any()) { var action = actions.Pop(); action(); } } AddValidatorToBehavior(ActionArgs.Single()); }
public void PushConditionBuildAction( BuildActionOrder order, ICondition <ValidationRequest> condition ) { PushGeneralBuildAction(order, () => { IValidator inner = ActionArgs.Pop(); IValidator conditional = new ConditionalValidator( condition, inner ); ActionArgs.Push(conditional); }); }