예제 #1
0
        public override string Start(string resourceXml)
        {
            try
            {
                Workflow workflow = XMLServiceFactory.Create(resourceXml);
                var      start    = workflow.Nodes.Where(n => n.NodeType == WorkflowNodeCategory.Start).FirstOrDefault();

                IList <Action <IDbConnection, IDbTransaction, string> > commands = new List <Action <IDbConnection, IDbTransaction, string> >();
                Func <IDbConnection, IDbTransaction, string>            callback = (connection, transaction) => InstanceService.CreateInstance(start.ID, resourceXml, workflow.Mode, (command, entry) => connection.Execute(command, entry, transaction));

                foreach (Node node in workflow.Nodes)
                {
                    commands.Add((connection, transaction, id) =>
                    {
                        node.InstanceID = id;
                        base.NodeService.Persistent(node, (command, entry) => connection.Execute(command, entry, transaction));
                    });
                }

                return(DbFactory.Execute(callback, commands));
            }
            catch (Exception ex)
            {
                Utils.LogError($"{ex.Message}, {ex.StackTrace}");
                throw ex;
            }
        }
예제 #2
0
        public override string Start(string resourceXml)
        {
            Workflow workflow  = XMLServiceFactory.Create(resourceXml);
            var      start     = workflow.Nodes.Where(n => n.NodeType == WorkflowNodeCategory.Start).FirstOrDefault();
            string   instaceID = InstanceService.CreateInstance(start.ID, resourceXml, workflow.Mode);

            foreach (Node node in workflow.Nodes)
            {
                node.InstanceID = instaceID;
                base.NodeService.Persistent(node);
            }
            return(instaceID);
        }
예제 #3
0
        public string Start(string resourceXml)
        {
            Workflow        workflow  = XMLServiceFactory.Create(resourceXml);
            IList <Element> elements  = workflow.GetElements();
            string          instaceID = CreateWorkflowInstance(workflow.Start.ID, resourceXml);

            foreach (Element element in elements)
            {
                element.InstanceID = instaceID;
                element.Persistent();
            }
            return(instaceID);
        }
예제 #4
0
        public override string Start(string resourceXml)
        {
            Workflow workflow = XMLServiceFactory.Create(resourceXml);
            var      start    = workflow.Nodes.Where(n => n.NodeType == WorkflowNodeCategory.Start).FirstOrDefault();
            IList <Action <ISession, string> > commands = new List <Action <ISession, string> >();

            string callback(ISession session) => InstanceService.CreateInstance(start.ID, resourceXml, (entry) => session.Persist(entry));

            foreach (Node node in workflow.Nodes)
            {
                commands.Add((session, id) =>
                {
                    node.InstanceID = id;
                    base.NodeService.Persistent(node, (entry) => session.Persist(entry));
                });
            }

            return(DbFactory.Execute(DbFactory.OpenSession(), callback, commands));
        }