public static IApplicationBuilder UseMyMiddlewareWithParams( this IApplicationBuilder builder, MyMiddlewareOptions myMiddlewareOptions) { return(builder.UseMiddleware <MyMiddlewareWithParams>( new OptionsWrapper <MyMiddlewareOptions>(myMiddlewareOptions))); }
public MyMiddlewareWithParams(RequestDelegate next, IOptions <MyMiddlewareOptions> optionsAccessor) { _next = next; _myMiddlewareOptions = optionsAccessor.Value; }