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); } }
protected virtual void OnPersistWorkflow(WfExecutorDataContext dataContext) { WfRuntime.PersistWorkflows(); }