Esempio n. 1
0
        public void PersistQueueBasicTest()
        {
            IWfProcess process = ProcessHelper.CreateSimpleProcessDescriptor().StartupProcess();

            ProcessHelper.OutputExecutionTime(() => WfRuntime.PersistWorkflows(), "保存简单流程");

            WfPersistQueue pq = WfPersistQueue.FromProcess(process);

            Console.WriteLine(pq.ProcessID);

            Assert.AreEqual(0, WfProcessCurrentAssigneeAdapter.Instance.Load(pq.ProcessID).Count);
            Assert.AreEqual(0, WfProcessRelativeParamsAdapter.Instance.Load(pq.ProcessID).Count);
            Assert.IsNull(WfProcessDimensionAdapter.Instance.Load(pq.ProcessID));

            WfPersistQueueAdapter.Instance.DoQueueOperation(pq);

            Assert.IsTrue(WfProcessCurrentAssigneeAdapter.Instance.Load(pq.ProcessID).Count > 0);
            Assert.AreEqual(process.RelativeParams.Count, WfProcessRelativeParamsAdapter.Instance.Load(pq.ProcessID).Count);

            WfProcessDimension pd = WfProcessDimensionAdapter.Instance.Load(pq.ProcessID);

            Assert.IsNotNull(pd);

            Console.WriteLine(pd.Data);
        }
Esempio n. 2
0
        protected void Regen_ExecuteStep(object data)
        {
            string processID = (string)data;

            try
            {
                IWfProcess process = WfRuntime.GetProcessByProcessID(processID);

                WfPersistQueue pq = WfPersistQueue.FromProcess(process);

                WfPersistQueueAdapter.Instance.DoQueueOperation(pq);
            }
            catch (System.Exception ex)
            {
                string message = string.Format("生成流程{0}的数据异常: {1}", processID, ex.Message);

                throw new ApplicationException(message, ex);
            }
        }