Esempio n. 1
0
        /// <summary>
        /// 方法异常处理
        /// </summary>
        /// <param name="requestMsg"></param>
        /// <param name="ex"></param>
        public override void OnException(System.Runtime.Remoting.Messaging.IMessage requestMsg, Exception ex)
        {
            var msg = requestMsg as System.Runtime.Remoting.Messaging.IMethodCallMessage;

            #region 异常
            AopLogAttribute logAttr = null;
            var             attrs   = msg.MethodBase.GetCustomAttributes(typeof(AopLogAttribute), false);
            if (attrs.Length > 0)
            {
                logAttr = attrs[0] as AopLogAttribute;
            }
            using (var business = new BusinessLog())
            {
                business.LogException(msg, logAttr, ex);
            }
            #endregion
        }
Esempio n. 2
0
        /// <summary>
        /// 方法执行前处理
        /// </summary>
        /// <param name="requestMsg"></param>
        public override void Invoking(System.Runtime.Remoting.Messaging.IMessage requestMsg)
        {
            var msg = requestMsg as System.Runtime.Remoting.Messaging.IMethodCallMessage;

            #region log
            AopLogAttribute logAttr = null;
            var             attrs   = msg.MethodBase.GetCustomAttributes(typeof(AopLogAttribute), false);
            if (attrs.Length > 0)
            {
                logAttr = attrs[0] as AopLogAttribute;
            }
            if (logAttr != null)
            {
                using (var business = new BusinessLog())
                {
                    business.LogBusiness(msg, logAttr);
                }
            }
            #endregion
        }