/// <summary> /// 动态获取路线,根据决策节点设置条件表达式,自动去判断流转的路线 /// </summary> /// <returns>路线</returns> public Transition GetTransition() { Command command = GetExecuteCmd(); List <WorkflowConfig> settings = WorkflowConfig.GetSettings(); WorkflowConfig config = settings .Where(cfg => cfg.ID == long.Parse(command.ID)) .FirstOrDefault(); IDbConnection connection = DapperFactory.CreateConnection(config.ProviderName, config.ConnectionString); try { DataTable resultSet = new DataTable(Guid.NewGuid().ToString()); using (IDataReader reader = connection.ExecuteReader(command.Text, new { InstanceID = InstanceID })) { resultSet.Load(reader); reader.Close(); } Transition instance = null; List <Transition> transitions = QueryWorkflowNode(NID); if (resultSet.Rows.Count > 0) { foreach (Transition transition in transitions) { if (resultSet.Select(transition.Expression).Length > 0) { instance = transition; break; } } } return(instance); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取配置 /// </summary> /// <returns></returns> public List <WorkflowConfig> GetSettings() { return(WorkflowConfig.GetSettings()); }