Ejemplo n.º 1
0
        private async Task ExecuteHandlerMethod(MethodInfo handlerMethodInfo, IMessageController controller, OwinContext context)
        {
            var properties = PropertieBuilder.Build(handlerMethodInfo, context, out bool error);

            if (error == true)
            {
                return;
            }

            var           obj          = handlerMethodInfo.Invoke(controller, properties.Values.ToArray());
            IActionResult actionResult = null;

            if (obj is Task <IActionResult> actionTask)
            {
                actionResult = await actionTask;
            }
            else if (obj is IActionResult)
            {
                actionResult = obj as IActionResult;
            }

            var actionContext = new ActionContext(context, new ActionDescriptor()
            {
            }, properties, controller);
            await actionResult.ExecuteResultAsync(actionContext);
        }
Ejemplo n.º 2
0
        private bool ExecuteBeforeHandlerMethod(MethodInfo method, IMessageController controller, OwinContext context)
        {
            var beforeProperties = PropertieBuilder.Build(method, context, out bool berror);

            if (berror == true)
            {
                return(false);
            }
            var beforeResult = (bool)method.Invoke(controller, beforeProperties.Values.ToArray());

            return(beforeResult);
        }