示例#1
0
        public static void Invoke(object instance, Expression <Action> member, Exception e)
        {
            var attribute = DynamicMethod.GetCallbackCustomAttribute <ExceptionNotityAttribute>(instance, member);

            if (attribute != null)
            {
                attribute.CatchException(e);
            }
        }
示例#2
0
        public static void Before(object sourceInstance, Expression <Action> sourceMember)
        {
            var attribute = DynamicMethod.GetCallbackCustomAttribute <LoggingAttribute>(sourceInstance, sourceMember);

            if (attribute != null)
            {
                var body           = (MethodCallExpression)sourceMember.Body;
                var callbackMethod = body.Method;
                attribute.WriteBeforeLog(callbackMethod.Name);
            }
        }