/// <summary> /// 注册工作流 /// </summary> /// <param name="flow"></param> public static bool RegisterWorkflow(IDoFlow flow) { try { readerWriterLockSlim.EnterReadLock(); if (flowEngines.ContainsKey(flow.Id)) { return(false); } flowEngines.Add(flow.Id, new FlowEngine(flow)); return(true); } finally { readerWriterLockSlim.ExitReadLock(); } }
/// <summary> /// 注册工作流 /// </summary> /// <param name="flow"></param> public static bool RegisterWorkflow <TDoFlow>() { Type type = typeof(TDoFlow); IDoFlow flow = (IDoFlow)Activator.CreateInstance(type); try { readerWriterLockSlim.EnterReadLock(); if (flowEngines.ContainsKey(flow.Id)) { return(false); } flowEngines.Add(flow.Id, new FlowEngine(flow)); return(true); } finally { readerWriterLockSlim.ExitReadLock(); } }
public FlowEngine(IDoFlow flow) { _flow = flow; }