Example #1
0
        public async Task <Modifiable> OnSending(ITypedBuilderContext context, HttpRequestMessage request, object content)
        {
            TypedSendingContext handlerContext = null;

            foreach (var handlerInfo in GetHandlerInfo(HandlerType.Sending))
            {
                if (handlerContext == null)
                {
                    handlerContext = ((Func <ITypedBuilderContext, HttpRequestMessage, object, TypedSendingContext>)handlerInfo.InitialConstructor)(context, request, content);
                }
                else
                {
                    handlerContext = ((Func <TypedSendingContext, TypedSendingContext>)handlerInfo.ContinuationConstructor)(handlerContext);
                }

                await handlerInfo.Handler(handlerContext);
            }

            return(handlerContext?.GetHandlerResult());
        }
 public virtual Task OnSending(TypedSendingContext context)
 {
     return(Task.FromResult(true));
 }
 internal TypedSendingContext(TypedSendingContext context)
     : base(context)
 {
 }