public static void Invoke(object instance, Expression <Action> member, Exception e) { var attribute = DynamicMethod.GetCallbackCustomAttribute <ExceptionNotityAttribute>(instance, member); if (attribute != null) { attribute.CatchException(e); } }
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); } }