public virtual void Remove(Func <PipelineContext <TInput, TOutput>, Task <bool> > rollForwardAction
                                   , Func <PipelineContext <TInput, TOutput>, Task <bool> > rollBackAction = null)
        {
            var existingModule = new DelegateModule <TInput, TOutput>(rollForwardAction, rollBackAction);

            Remove(existingModule);
        }
        public virtual void RegisterAfter(IPipelineModule <TInput, TOutput> existingModule
                                          , Func <PipelineContext <TInput, TOutput>, Task <bool> > rollForwardAction
                                          , Func <PipelineContext <TInput, TOutput>, Task <bool> > rollBackAction = null)
        {
            var newModule = new DelegateModule <TInput, TOutput>(rollForwardAction, rollBackAction);

            RegisterAfter(existingModule, newModule);
        }
        public override bool Equals(object obj)
        {
            if (obj == null || (obj is DelegateModule <TInput, TOutput>) == false)
            {
                return(false);
            }

            DelegateModule <TInput, TOutput> another = (DelegateModule <TInput, TOutput>)obj;

            bool forwardEquals = RollForwardAction.GetMethodInfo().Name == another.RollForwardAction.GetMethodInfo().Name &&
                                 RollForwardAction.Target == another.RollForwardAction.Target;

            if (forwardEquals == false)
            {
                return(false);
            }

            if (RollBackAction == null && another.RollBackAction == null)
            {
                return(true);
            }
            else if (RollBackAction == null && another.RollBackAction != null)
            {
                return(false);
            }
            else if (RollBackAction != null && another.RollBackAction == null)
            {
                return(false);
            }
            else
            {
                bool equals = RollBackAction.GetMethodInfo().Name == another.RollBackAction.GetMethodInfo().Name &&
                              RollBackAction.Target == another.RollBackAction.Target;
                return(equals);
            }
        }