/// <summary>
        /// Start the pipeline and execute the middleware sequentially.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException"></exception>
        public async Task <IPipelineBuilder> Launch()
        {
            if (nodes == null || nodes.Count == 0)
            {
                throw new ArgumentNullException(nameof(nodes));
            }
            _components = new MiddlewareStack(nodes);
            await _components.Pop().Next.Invoke(_context, _components);

            return(this);
        }
Esempio n. 2
0
 public IAppBuilder Use <TApp>(Func <TApp, TApp> middleware)
 {
     MiddlewareStack.Push(middleware);
     return(this);
 }