示例#1
0
        private ResponseMethodDTO ExecuteRedirectView(MethodInfo methodToExecute, object[] parameters, IViewHandler viewHandler, MethodInfo methodToResponse)
        {
            ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO)FactoryDTO.Instance.Create(CreateDTO.ResponseMethod);

            try {
                object ret = methodToExecute.Invoke(this, parameters);
                responseMethodDTO.MethodResult = ret;
                responseMethodDTO.SetExecutionSuccess(true);
                if (VirtualMethod != null)
                {
                    VirtualMethod(responseMethodDTO);
                    VirtualMethod = null;
                }
                //Beta Implementation
                //
                if (!ViewHandlerCollection.Contains(viewHandler))
                {
                    ViewHandlerCollection.Add(viewHandler);
                    logger.Debug("A new view has been added to View Cache");
                }
                else
                {
                    logger.Debug("This view has already been registered at View Cache.");
                }
                //
                //End

                methodToResponse.Invoke(viewHandler, new object[] { responseMethodDTO });
            }
            catch (TargetInvocationException exception) {
                this.MapException(exception);
            }
            return(responseMethodDTO);
        }
示例#2
0
        private ResponseMethodDTO ExecuteRedirectNewView(MethodInfo methodToExecute, object[] parameters, Type viewType, MethodInfo methodToResponse)
        {
            ResponseMethodDTO responseMethodDTO = (ResponseMethodDTO)FactoryDTO.Instance.Create(CreateDTO.ResponseMethod);

            try {
                object ret = methodToExecute.Invoke(this, parameters);
                responseMethodDTO.MethodResult = ret;
                object obj = viewType.GetConstructor(null).Invoke(null);
                responseMethodDTO.SetExecutionSuccess(true);
                if (VirtualMethod != null)
                {
                    VirtualMethod(responseMethodDTO);
                    VirtualMethod = null;
                }
                methodToResponse.Invoke(obj, new object[] { responseMethodDTO });
                //Beta Implementation
                //
                //Siempre se va a añadir esta vista puesto que es una vista
                //nueva.
                ViewHandlerCollection.Add((IViewHandler)obj);
                logger.Debug("A new view has been added to View Cache.");
                //
                //End
                return(responseMethodDTO);
            }
            catch (TargetInvocationException exception) {
                this.MapException(exception);
            }
            return(responseMethodDTO);
        }