Exemplo n.º 1
0
        public int Code2(ref int i, int j, ref int k)
        {
            var types      = new Type[] { typeof(int).MakeByRefType() };
            var codeMethod = developer.GetType().GetMethod("Code", types);
            var aspectArgs = new FunctionExecutionArgsImpl <CSharpDeveloperMixin, int, int, int, int>(developer, codeMethod, i, j, k);

            Aspects.traceAspect3.OnEntry(aspectArgs);

            try {
                i = aspectArgs.Arg1;
                k = aspectArgs.Arg3;
                aspectArgs.ReturnValue = developer.Code(ref i, aspectArgs.Arg2, ref k);
                aspectArgs.Arg1        = i;
                aspectArgs.Arg3        = j;
                Aspects.traceAspect3.OnSuccess(aspectArgs);
            }
            //catch (Exception ex) {
            //    aspectArgs.Exception = ex;
            //    Aspects.traceAspect3.OnException(aspectArgs);

            //    if (aspectArgs.FlowBehavior == FlowBehavior.RethrowException) {
            //        throw;
            //    }
            //}
            finally {
                Aspects.traceAspect3.OnExit(aspectArgs);
            }

            return(aspectArgs.ReturnValue);
        }
Exemplo n.º 2
0
        public int Proceed(ref CSharpDeveloperMixin instance, IFunctionArgs <int, int, int, int> args)
        {
            //var aspectArgs = new FunctionInterceptionArgsImpl<CSharpDeveloperMixin, int, int, int, int>(instance, args.Method, MethodDecoratorFunctionBinding.singleton, args.Arg1, args.Arg2, args.Arg3);

            //Aspects.traceAspect.OnInvoke(aspectArgs);
            //FunctionArgsMapper.Map<int, int, int, int>(aspectArgs, args);

            //return args.ReturnValue;
            //var binding = MethodDecoratorFunctionBinding.singleton;
            var aspectArgs = new FunctionExecutionArgsImpl <CSharpDeveloperMixin, int, int, int, int>(instance, args.Method, args.Arg1, args.Arg2, args.Arg3);

            Aspects.traceAspect3.OnEntry(aspectArgs);

            try {
                var i = aspectArgs.Arg1;
                var k = aspectArgs.Arg3;
                aspectArgs.ReturnValue = instance.Code(ref i, aspectArgs.Arg2, ref k);
                aspectArgs.Arg1        = i;
                aspectArgs.Arg3        = k;
                Aspects.traceAspect3.OnSuccess(aspectArgs);
            }
            finally {
                Aspects.traceAspect3.OnExit(aspectArgs);
            }

            return(aspectArgs.ReturnValue);
        }