/// <summary>
        /// 动态获取路线,根据决策节点设置条件表达式,自动去判断流转的路线
        /// </summary>
        /// <returns>路线</returns>
        public Transition GetTransition(ASTNode n)
        {
            Command command = this.CommandService.Query(n.InstanceID)
                              .Where(e => e.RelationshipID == n.NID)
                              .FirstOrDefault();

            IList <WorkflowConfiguration> settings = ConfigurationService.Query();
            WorkflowConfiguration         config   = settings
                                                     .Where(cfg => cfg.ID == long.Parse(command.ID))
                                                     .FirstOrDefault();

            IDbConnection connection = DbFactory.CreateConnection(config.ProviderName, config.ConnectionString);

            try
            {
                DataTable resultSet = new DataTable(Guid.NewGuid().ToString());
                using (IDataReader reader = connection.ExecuteReader(command.Text, new { n.InstanceID }))
                {
                    resultSet.Load(reader);
                    reader.Close();
                }
                Transition        instance    = null;
                List <Transition> transitions =
                    this.TransitionService
                    .Query(n.InstanceID)
                    .Where(t => t.RelationshipID == n.NID)
                    .ToList();

                if (resultSet.Rows.Count > 0)
                {
                    foreach (Transition transition in transitions)
                    {
                        if (!String.IsNullOrEmpty(transition.Expression) && resultSet.Select(transition.Expression).Length > 0)
                        {
                            instance = transition;
                            break;
                        }
                    }
                }

                resultSet.Dispose();
                return(instance);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void Execute(Node n)
 {
     if (n.Command != null)
     {
         Command command = n.Command;
         IList <WorkflowConfiguration> settings = ConfigurationService.Query();
         WorkflowConfiguration         config   = settings
                                                  .Where(cfg => cfg.ID == long.Parse(command.ID))
                                                  .FirstOrDefault();
         IDbConnection connection = DbFactory.CreateConnection(config.ProviderName, config.ConnectionString);
         try
         {
             connection.Execute(command.Text, new { n.InstanceID });
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
 }