Beispiel #1
0
        /// <summary>
        /// Invoked automatically in mvc middleware.
        /// </summary>
        public static void AddBotExtMvcGlobalValidator(this IPipelineBuilder @this, int botExtOrder, Action <UpdateContext> setGlobalSearchBag)
        {
            IOuterMiddlewaresInformer outerMiddlewaresInformer = null;

            @this.AddBotExtGlobalValidator(async(newCtx, origCtx) =>
            {
                setGlobalSearchBag(newCtx);
                if (outerMiddlewaresInformer == null)
                {
                    var provider             = origCtx.Services.GetRequiredService <IOuterMiddlewaresInformerProvider>();
                    outerMiddlewaresInformer = provider.OuterMiddlewaresInformer;
                }
                var mvcWillHandle = await outerMiddlewaresInformer.CheckMvcHasPriorityHandler(newCtx, botExtOrder);
                return(mvcWillHandle ? UpdateValidatorResult.AbortWaiter : UpdateValidatorResult.Valid);
            });
        }