/// <summary> /// use HTTP pipeline /// </summary> /// <param name="builder">asp.net core application builder</param> /// <param name="accessPoint">HTTP pipeline asp.net core access point</param> /// <returns>HTTP pipeline</returns> public static IHttpPipeline UsePipeline(this IApplicationBuilder builder, IHttpPipelineAccessPoint <RequestDelegate> accessPoint) { return(accessPoint.AsPipeline(application => { var logger = builder.ApplicationServices.GetService <ILogger <AspNetCoreCombinator> >(); if (logger != null) { logger.LogInformation("http pipeline injected."); } builder.Run(application); })); }
public CombinatorPipelineWrapper(IHttpPipelineAccessPoint <T> accessPoint, Action <T> combinedAction) { _accessPoint = accessPoint; _combinedAction = combinedAction; }
/// <summary> /// returns the accesspoint as a HTTP pipeline. /// </summary> /// <remarks> /// it's create a dummy pipeline object, it can not as downstream pipeline joined by anothor pipeline. /// </remarks> /// <typeparam name="T">access point type</typeparam> /// <param name="accessPoint">access point</param> /// <param name="combinedAction">action of combined</param> /// <returns></returns> public static IHttpPipeline AsPipeline <T>(this IHttpPipelineAccessPoint <T> accessPoint, Action <T> combinedAction) { return(new CombinatorPipelineWrapper <T>(accessPoint, combinedAction)); }
public HttpPipeline(IApplicationBuilder builder, IHttpPipelineAccessPoint <Func <RequestDelegate, RequestDelegate> > accessPoint) { _builder = builder ?? throw new ArgumentNullException(nameof(builder)); _accessPoint = accessPoint ?? throw new ArgumentNullException(nameof(accessPoint)); }
/// <summary> /// 使用 HTTP 请求处理管线 /// </summary> /// <param name="application">ASP.NET Core 应用构建器</param> /// <param name="configure">处理管线构建程序</param> public static IHttpPipeline UsePipeline(this IApplicationBuilder application, IHttpPipelineAccessPoint <Func <RequestDelegate, RequestDelegate> > accessPoint) { return(new HttpPipeline(application, accessPoint)); }