Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #3
0
        public static void PrintEvn()
        {
            //如果不是二次开发操作员则不显示日志
            if (!AddinOperator.CurrentUserIsOperator())
            {
                return;
            }

            var data = AddinEnvironment.RequestParams();

            foreach (var item in data.AllKeys)
            {
                Logger.Info(item + " : " + data[item]);
            }
        }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public IList <ServiceUIParamBizModel> GetServiceRequestParameters()
 {
     return(AddinEnvironment.GetServiceUIParams());
 }