Exemplo n.º 1
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);
        }
Exemplo n.º 2
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));
        }
Exemplo n.º 3
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 <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));
        }