public virtual object ResolveDelegateClass(IActivityExecution execution)
        {
            IProcessApplicationReference targetProcessApplication = ProcessApplicationContextUtil.GetTargetProcessApplication((ExecutionEntity)execution);

            if (ProcessApplicationContextUtil.RequiresContextSwitch(targetProcessApplication))
            {
                return(Context.ExecuteWithinProcessApplication(
                           () => ResolveDelegateClass(execution), targetProcessApplication,
                           new InvocationContext(execution)));
            }
            else
            {
                return(InstantiateDelegateClass(execution));
            }
        }
        public virtual void HandleInvocation(DelegateInvocation invocation)
        {
            var processApplication = GetProcessApplicationForInvocation(invocation);

            if ((processApplication != null) && ProcessApplicationContextUtil.RequiresContextSwitch(processApplication))
            {
                Context.ExecuteWithinProcessApplication <object>(() =>
                {
                    HandleInvocation(invocation);
                    return(null);
                },
                                                                 processApplication, new InvocationContext(invocation.ContextExecution));
            }
            else
            {
                HandleInvocationInContext(invocation);
            }
        }
        // Signallable activity behavior
        public override void Signal(IActivityExecution execution, string signalName, object signalData)
        {
            var targetProcessApplication =
                ProcessApplicationContextUtil.GetTargetProcessApplication((ExecutionEntity)execution);

            if (ProcessApplicationContextUtil.RequiresContextSwitch(targetProcessApplication))
            {
                Context.ExecuteWithinProcessApplication <object>(() =>
                {
                    Signal(execution, signalName, signalData);
                    return(null);
                }, targetProcessApplication,
                                                                 new InvocationContext(execution));
            }
            else
            {
                DoSignal(execution, signalName, signalData);
            }
        }
Example #4
0
        //protected internal virtual IProcessApplicationReference GetTargetProcessApplication(CaseExecutionEntity execution)
        //{
        //    return ProcessApplicationContextUtil.getTargetProcessApplication(execution);
        //}

        protected internal virtual bool RequiresContextSwitch(IProcessApplicationReference processApplicationReference)
        {
            return(ProcessApplicationContextUtil.RequiresContextSwitch(processApplicationReference));
        }