public MiddlewareRegistration(IMiddlewareBuilder middlewareBuilder, MiddlewareStage stage, int priority, int index)
 {
     this.MiddlewareBuilder = middlewareBuilder;
     this.Stage             = stage;
     this.Priority          = priority;
     this.Index             = index;
 }
        public PipelineBuilder AddMiddleware(IMiddlewareBuilder builder, MiddlewareStage middlewareStage)
        {
            this.Add(builder, middlewareStage, 0);

            return(this);
        }
 private void Add(IMiddlewareBuilder middleware, MiddlewareStage middlewareStage, int priority)
 {
     this._middlewareStages.Add(new MiddlewareRegistration(middleware, middlewareStage, priority, this._middlewareStages.Count));
 }
        public PipelineBuilder AddMiddleware <T>(MiddlewareStage middlewareStage) where T : IMiddlewareBuilder, new()
        {
            this.Add(new T(), middlewareStage, 0);

            return(this);
        }