示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="processType"></param>
        /// <param name="startupParams"></param>
        /// <returns></returns>
        public static IWfProcess StartWorkflow(System.Type processType, WfProcessStartupParams startupParams)
        {
            ExceptionHelper.FalseThrow <ArgumentNullException>(processType != null, "processType");
            ExceptionHelper.FalseThrow <ArgumentNullException>(startupParams != null, "startupParams");

            IWfProcess process = (IWfProcess)Activator.CreateInstance(processType, true);

            Type[] types = new Type[] { };

            ConstructorInfo constructorInfoObj = process.GetType().GetConstructor(
                BindingFlags.Instance | BindingFlags.Public, null,
                CallingConventions.HasThis, types, null);

            if (constructorInfoObj != null)
            {
                process = (IWfProcess)constructorInfoObj.Invoke(new object[] { });
            }

            process.Creator         = startupParams.Operator;
            process.OwnerDepartment = startupParams.Department;
            process.ResourceID      = startupParams.ResourceID;

            WorkflowSettings.GetConfig().EnqueueWorkItemExecutor.EnqueueInitialWfWorkItem(process);

            AddProcessToCache(process.ID, process);

            return(process);
        }
示例#2
0
        protected IWfProcess CreateBranchProcess(IWfProcessDescriptor descriptor)
        {
            WfProcessStartupParams branchProcessStartupParam = new WfProcessStartupParams(descriptor);

            return(WfRuntime.StartWorkflow(this.AnchorActivity.Process.GetType(), branchProcessStartupParam));
        }