示例#1
0
 /// <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();
     }
 }
示例#2
0
        /// <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();
            }
        }
示例#3
0
 public FlowEngine(IDoFlow flow)
 {
     _flow = flow;
 }