public FlowAction(bool isInner, int flowId) { try { F_FLOW_CONFIG actionDllName = DAL.WorkFlow.Flow. GetFlowConfig(flowId, "ActionDllName").SingleOrDefault(); F_FLOW_CONFIG actionClassName = DAL.WorkFlow.Flow. GetFlowConfig(flowId, "ActionClassName").SingleOrDefault(); if (actionDllName != null && actionClassName != null && !string.IsNullOrEmpty(actionDllName.ItemValue) && !string.IsNullOrEmpty(actionClassName.ItemValue)) { action = (T)Assembly. Load(actionDllName.ItemValue). CreateInstance(actionClassName.ItemValue); } else { string className = string.Format("FLOW{0}.Action", flowId); string dllName = string.Format("FLOW{0}", flowId); action = (T)Assembly.Load(dllName).CreateInstance(className); } } catch { //Log4Net.LogError("实例化流程Action实现类", ex.ToString()); } }
public static bool InsertFlowConfig(string value) { using (MainDataContext dbContext = new MainDataContext()) { try { F_FLOW_CONFIG cot = new F_FLOW_CONFIG(); cot.ItemValue = value; cot.FlowID = 99; cot.ItemName = "Project"; dbContext.F_FLOW_CONFIG.InsertOnSubmit(cot); dbContext.SubmitChanges(); return(true); } catch (Exception ex) { return(false); } } }