コード例 #1
0
        public Task Run([NotNull] FlowDescription flowDescription)
        {
            flowDescription.AssertNotNull("flowDescription != null");
            flowDescription.InitialNode.AssertNotNull("Initial node isn't set");

            return(flowDescription.InitialNode.Accept(this));
        }
コード例 #2
0
 protected override void PerformGlobalValidation(FlowDescription flowDescription)
 {
     if (flowDescription.InitialNode == null)
     {
         Result.AddError("Initial node isn't set");
     }
 }
コード例 #3
0
        protected override void PerformGlobalValidation(FlowDescription flowDescription)
        {
            foreach (IFlowNode node in flowDescription.Nodes)
            {
                if (!myReachableNodes.Contains(node) &&
                    node != flowDescription.InitialNode &&
                    node != flowDescription.DefaultFaultHandler &&
                    node != flowDescription.DefaultCancellationHandler)
                {
                    Result.AddError(node, "Node isn't reachable from any other node");
                }
            }

            myReachableNodes.Clear();
        }
コード例 #4
0
        private static ValidationResult ValidateFlow(
            [NotNull] ValidatorCollection validators,
            [NotNull] FlowDescription flowDescription)
        {
            var validationResult = new ValidationResult();

            foreach (FlowValidator validator in validators)
            {
                if (!validator.Validate(flowDescription))
                {
                    validationResult.TakeErrorsFrom(validator.Result);
                }
            }

            return(validationResult);
        }
コード例 #5
0
        public bool Validate([NotNull] FlowDescription flowDescription)
        {
            Flow = flowDescription.NotNull();
            Result.ClearErrors();

            foreach (IFlowNode node in flowDescription.Nodes)
            {
                node.Accept(this);
            }

            PerformGlobalValidation(flowDescription);

            Flow = null;

            return(!Result.HasErrors);
        }
コード例 #6
0
 public DefaultHandlersSetter([NotNull] FlowDescription flowDescription)
 {
     myFlowDescription     = flowDescription.NotNull();
     myFaultHandler        = flowDescription.DefaultFaultHandler;
     myCancellationHandler = flowDescription.DefaultCancellationHandler;
 }
コード例 #7
0
 protected virtual void PerformGlobalValidation([NotNull] FlowDescription flowDescription)
 {
 }