Exemple #1
0
        protected override bool Process(IInteraction parameters)
        {
            Service         referredService = null;
            JumpInteraction jumpInteraction = null;

            string pickedBranchName = "";

            if (BranchName == null)
            {
                if (!parameters.TryGetFallbackString(this.BranchVariable, out pickedBranchName))
                {
                    throw new ModuleBranchException(this.BranchVariable);
                }
            }
            else
            {
                pickedBranchName = BranchName;
            }

            referredService = GetService(pickedBranchName);

            if (referredService == null)
            {
                throw new NullReferenceException(
                          string.Format("Branch with name '{0}' was not found among [{1}]",
                                        pickedBranchName,
                                        File
                                        )
                          );
            }
            else
            {
                jumpInteraction = CreateJump(parameters);
            }

            return(referredService.TryProcess(jumpInteraction));
        }
Exemple #2
0
        protected bool TryGetReturnService(IInteraction parameters, out Service returnService)
        {
            JumpInteraction jumpParameters = (JumpInteraction)parameters.GetClosest(typeof(JumpInteraction));

            return(jumpParameters.TryGetDeepBranch(BranchName, out returnService));
        }