Exemplo n.º 1
0
        public static void ProcessPendingActivity(WfPendingActivityInfo pendingActivityInfo)
        {
            pendingActivityInfo.NullCheck("pendingActivityInfo");

            IWfProcess process = GetProcessByActivityID(pendingActivityInfo.ActivityID);
            bool       needToDeletePendingInfo = true;

            if (process != null)
            {
                IWfActivity currentActivity = process.CurrentActivity;

                process.ProcessPendingActivity();

                if (currentActivity != null)
                {
                    needToDeletePendingInfo = false;

                    //已经不存在Pending状态
                    if (currentActivity.Status != WfActivityStatus.Pending)
                    {
                        WfRuntime.ProcessContext.AffectedProcesses.AddOrReplace(process);

                        using (TransactionScope scope = TransactionScopeFactory.Create())
                        {
                            WfRuntime.PersistWorkflows();
                            WfPendingActivityInfoAdapter.Instance.Delete(pendingActivityInfo);

                            scope.Complete();
                        }
                    }
                }
            }

            if (needToDeletePendingInfo)
            {
                WfPendingActivityInfoAdapter.Instance.Delete(pendingActivityInfo);
            }
        }
Exemplo n.º 2
0
 protected virtual void OnPersistWorkflow(WfExecutorDataContext dataContext)
 {
     WfRuntime.PersistWorkflows();
 }