Пример #1
0
        public object Invoke(IMethodInvocation invocation)
        {
            RecordAuditorClassAttribute auditorClassAttribute = GetRecordAuditorAttribute(invocation.TargetType);

            logger.Info("开始:  " + invocation.TargetType.Name + "." + invocation.Method.Name);


            DateTime operateTime = System.DateTime.Now;

            int operateUserID = SystemUserWrapper.GetCurrentOperateUserID();

            switch (invocation.Method.Name)
            {
            case "Save":
                SetCreateInfo(invocation.Arguments[0], operateTime, operateUserID, invocation.Method.Name);
                break;

            case "Update":
                SetUpdateInfo(invocation.Arguments[0], operateTime, operateUserID, invocation.Method.Name);
                break;

            case "SaveOrUpdate":
                break;
            }


            object result = invocation.Proceed();

            logger.Info("结束:  " + invocation.TargetType.Name + "." + invocation.Method.Name);

            return(result);
        }