Ejemplo n.º 1
0
        public void Before(MethodInfo method, object[] args, object target)
        {
            //打出环境参数
            LogHelper <BeforeAdvice> .PrintEvn();

            AddinMethodInvocation invocation = new AddinMethodInvocation(method, args, target);

            //请求的参数保存到当前的服务器内存中
            AddinEnvironment.SaveServiceRequestParam(invocation);

            bool rtn = false;

            try
            {
                rtn = executor.ExecuteBeforeMethod(method, args, target);
                //是否要判断返回值来处理
                LogHelper <BeforeAdvice> .Error("功能注入方法前方法执行结果:" + rtn);
            }
            catch (Exception e)
            {
                LogHelper <BeforeAdvice> .Error("功能注入执行方法前方法出错:" + e.StackTrace);

                throw new AddinException("功能注入提示信息:" + e.Message);
            }
        }
Ejemplo n.º 2
0
        public void AfterReturning(object returnValue, MethodInfo method, object[] args, object target)
        {
            //打出环境参数
            LogHelper <AfterAdvice> .PrintEvn();

            AddinMethodInvocation invocation = new AddinMethodInvocation(method, args, target);

            AddinEnvironment.SaveServiceRequestParam(invocation);


            try
            {
                LogHelper <AfterAdvice> .Info("方法执行的结果是:" + (returnValue == null ? "null":returnValue.ToString()));

                bool rtn = executor.ExecuteAfterMethod(returnValue, method, args, target);
                //是否要判断返回值来处理
                LogHelper <AfterAdvice> .Info("功能注入方法执行的结果是:" + rtn);
            }
            catch (Exception e)
            {
                LogHelper <AfterAdvice> .Error("执行方法后方法出错:" + e.StackTrace);

                throw new AddinException("功能注入提示信息:" + e.Message);
            }
        }