This release includes support for asynchronous When predicates, for example:
await Pipeline.Build<TestContext>(cfg =>
cfg
.When(async ctx => await ValidateAccessAsync(ctx["id"]), builder =>
builder.Add((ctx, next) =>
{
using (LogContext.PushProperty("id", ctx["id"]))
{
return next.Invoke(ctx);
}
})
)
.Final(async (ctx) =>
{
await Execute(ctx);
return ctx;
})
)
.Invoke(new TestContext());
Thanks to @andreas-antoniou-cko for contributing this feature.