/// <summary>
 /// 设置下一个处理者
 /// </summary>
 /// <param name="handler">下一个处理者</param>
 /// <returns>返回下一个处理者</returns>
 public ChainOfResponsibilityHandler <TInput, TResult> SetNext(ChainOfResponsibilityHandler <TInput, TResult> handler)
 {
     if (handler == this)
     {
         throw new ArgumentException("不能传递自己作为参数");
     }
     Next = handler;
     return(Next);
 }
Exemple #2
0
        private ChainOfResponsibilityHandler <TInput, TResult> GetHandler()
        {
            if (Handler != null)
            {
                return(Handler);
            }

            Handler = InitChain();
            if (Handler == null)
            {
                throw new ArgumentNullException("InitChain 方法返回空");
            }
            return(Handler);
        }