/// <summary> /// Wraps the specified <see cref="PipelineItem{T}"/> instance into its async form. /// </summary> /// <param name="pipelineItem">The <see cref="PipelineItem{T}"/> instance.</param> /// <returns>Async <see cref="PipelineItem{T}"/> instance</returns> protected override PipelineItem <Func <NancyContext, CancellationToken, Task> > Wrap(PipelineItem <Action <NancyContext> > pipelineItem) { return(new PipelineItem <Func <NancyContext, CancellationToken, Task> >(pipelineItem.Name, (ctx, ct) => { pipelineItem.Delegate(ctx); return TaskHelpers.CompletedTask; })); }
/// <summary> /// Wraps the specified <see cref="PipelineItem{T}"/> into its async form. /// </summary> /// <param name="pipelineItem">The <see cref="PipelineItem{T}"/>.</param> /// <returns>Async <see cref="PipelineItem{T}"/> instance</returns> protected override PipelineItem <Func <NancyContext, CancellationToken, Task <Response> > > Wrap(PipelineItem <Func <NancyContext, Response> > pipelineItem) { return(new PipelineItem <Func <NancyContext, CancellationToken, Task <Response> > >(pipelineItem.Name, (ctx, ct) => Task.FromResult(pipelineItem.Delegate(ctx)))); }