コード例 #1
0
 public override void OnEntry(FunctionExecutionArgs <List <AspectJoinPoints>, string> args)
 {
     args.FlowBehavior = FlowBehavior.Continue;
     args.Arg1.Add(AspectJoinPoints.OnEntry);
     args.AddToReturnValue(AspectJoinPoints.OnEntry);
     base.OnEntry(args);
 }
コード例 #2
0
 public override void OnSuccess(FunctionExecutionArgs <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, string> args)
 {
     args.Arg1.Add(AspectJoinPoints.OnSuccess);
     args.Arg2.Add(AspectJoinPoints.OnSuccess);
     args.Arg3.Add(AspectJoinPoints.OnSuccess);
     base.OnSuccess(args);
 }
コード例 #3
0
 public override void OnEntry(FunctionExecutionArgs <int, int, int, int, int, int, int, int, string> args)
 {
     args.FlowBehavior = FlowBehavior.Continue;
     args.Arg8         = args.Arg7 = args.Arg6 = args.Arg5 = args.Arg4 = args.Arg3 = args.Arg2 = args.Arg1 += (int)AspectJoinPoints.OnEntry;
     args.AddToReturnValue(AspectJoinPoints.OnEntry);
     base.OnEntry(args);
 }
コード例 #4
0
 public override void OnExit(FunctionExecutionArgs <List <AspectJoinPoints>, List <AspectJoinPoints>, string> args)
 {
     args.Arg1.Add(AspectJoinPoints.OnExit);
     args.Arg2.Add(AspectJoinPoints.OnExit);
     args.AddToReturnValue(AspectJoinPoints.OnExit);
     base.OnExit(args);
 }
コード例 #5
0
 public override void OnSuccess(FunctionExecutionArgs <string> args)
 {
     stopwatch.Stop();
     Console.WriteLine("{0} OnSuccess", args.Method.Name);
     Console.WriteLine("Elapsed Ticks: {0}", stopwatch.ElapsedTicks);
     Console.WriteLine("Return value: {0}", args.ReturnValue);
 }
 public override void OnSuccess(FunctionExecutionArgs args)
 {
     // Store in cache
     _cache.Add((string)args.Tag, args.ReturnValue,
                new CacheItemPolicy {
         AbsoluteExpiration = DateTime.UtcNow + _cacheTimeout
     });
 }
        public override void OnExit(FunctionExecutionArgs args)
        {
            var sw = (Stopwatch)args.Tag;

            sw.Stop();

            Debug.WriteLine("{0} executed in {1} milliseconds", args.FunctionName, sw.ElapsedMilliseconds);
        }
コード例 #8
0
 public void OnEntry(FunctionExecutionArgs args)
 {
     if (ExcelDnaUtil.IsInFunctionWizard())
     {
         args.ReturnValue  = _dialogResult;
         args.FlowBehavior = FlowBehavior.Return;
     }
     // Otherwise we do not interfere
 }
コード例 #9
0
        public override void OnEntry(FunctionExecutionArgs args)
        {
            // FunctionExecutionArgs gives access to the function name and parameters,
            // and gives some options for flow redirection.

            // Tag will flow through the whole handler
            args.Tag = args.FunctionName + ":" + Index;
            Debug.Print("{0} - OnEntry - Args: {1}", args.Tag, string.Join(",", args.Arguments.Select(arg => arg.ToString())));
        }
コード例 #10
0
        internal static void AddToReturnValue(this FunctionExecutionArgs <string> args, AspectJoinPoints joinPoint)
        {
            if (args.ReturnValue.IsNullOrEmpty())
            {
                args.ReturnValue = joinPoint.ToString();
                return;
            }

            args.ReturnValue = format.Fmt(args.ReturnValue, joinPoint.ToString());
        }
コード例 #11
0
 public override void OnExit(FunctionExecutionArgs <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, string> args)
 {
     args.Arg1.Add(AspectJoinPoints.OnExit);
     args.Arg2.Add(AspectJoinPoints.OnExit);
     args.Arg3.Add(AspectJoinPoints.OnExit);
     args.Arg4.Add(AspectJoinPoints.OnExit);
     args.Arg5.Add(AspectJoinPoints.OnExit);
     args.Arg6.Add(AspectJoinPoints.OnExit);
     args.Arg7.Add(AspectJoinPoints.OnExit);
     base.OnExit(args);
 }
        string GenerateKey(FunctionExecutionArgs args)
        {
            var keyBuilder = new StringBuilder(args.FunctionName);

            foreach (var arg in args.Arguments)
            {
                keyBuilder.Append('\0');    // 0-delimited !?
                keyBuilder.Append(arg);
            }
            return(keyBuilder.ToString());
        }
コード例 #13
0
 public override void OnEntry(FunctionExecutionArgs <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, string> args)
 {
     args.FlowBehavior = FlowBehavior.Continue;
     args.Arg1.Add(AspectJoinPoints.OnEntry);
     args.Arg2.Add(AspectJoinPoints.OnEntry);
     args.Arg3.Add(AspectJoinPoints.OnEntry);
     args.Arg4.Add(AspectJoinPoints.OnEntry);
     args.Arg5.Add(AspectJoinPoints.OnEntry);
     args.Arg6.Add(AspectJoinPoints.OnEntry);
     args.Arg7.Add(AspectJoinPoints.OnEntry);
     base.OnEntry(args);
 }
コード例 #14
0
        public override void OnException(FunctionExecutionArgs <List <AspectJoinPoints>, string> args)
        {
            var ex = args.Exception;

            if (ex.IsNotNull() && ex.GetType() == typeof(Exception) && ex.Message.Equals("InMethodException"))
            {
                args.Arg1.Add(AspectJoinPoints.OnException);
                args.AddToReturnValue(AspectJoinPoints.OnException);
            }

            base.OnException(args);
        }
コード例 #15
0
        public override void OnException(FunctionExecutionArgs <int, int, int, int, int, int, int, int, string> args)
        {
            var ex = args.Exception;

            if (ex.IsNotNull() && ex.GetType() == typeof(Exception) && ex.Message.Equals("InMethodException"))
            {
                args.Arg8 = args.Arg7 = args.Arg6 = args.Arg5 = args.Arg4 = args.Arg3 = args.Arg2 = args.Arg1 += (int)AspectJoinPoints.OnException;
                args.AddToReturnValue(AspectJoinPoints.OnException);
            }

            base.OnException(args);
        }
コード例 #16
0
 public override void OnEntry(FunctionExecutionArgs <List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, List <AspectJoinPoints>, string> args)
 {
     args.Arg1.Add(AspectJoinPoints.OnEntry);
     args.Arg2.Add(AspectJoinPoints.OnEntry);
     args.Arg3.Add(AspectJoinPoints.OnEntry);
     args.Arg4.Add(AspectJoinPoints.OnEntry);
     args.Arg5.Add(AspectJoinPoints.OnEntry);
     args.Arg6.Add(AspectJoinPoints.OnEntry);
     args.Arg7.Add(AspectJoinPoints.OnEntry);
     args.AddToReturnValue(AspectJoinPoints.OnEntry);
     base.OnEntry(args);
 }
        public override void OnEntry(FunctionExecutionArgs args)
        {
            string key = GenerateKey(args);

            args.Tag = key;

            object result = _cache[key];

            if (result != null)
            {
                // Set the return value and FlowBehavior, to short-cut the function call
                args.ReturnValue  = result;
                args.FlowBehavior = FlowBehavior.Return;
            }
        }
コード例 #18
0
 public override void OnExit(FunctionExecutionArgs <int, int, int, int, int, int, int, int, string> args)
 {
     args.Arg8 = args.Arg7 = args.Arg6 = args.Arg5 = args.Arg4 = args.Arg3 = args.Arg2 = args.Arg1 += (int)AspectJoinPoints.OnExit;
     args.AddToReturnValue(AspectJoinPoints.OnExit);
     base.OnExit(args);
 }
コード例 #19
0
 public override void OnSuccess(FunctionExecutionArgs <int, int, int, int, int, int, int, int, string> args)
 {
     args.Arg1 = args.Arg1 + (int)AspectJoinPoints.OnSuccess;
     args.AddToReturnValue(AspectJoinPoints.OnSuccess);
     base.OnSuccess(args);
 }
コード例 #20
0
ファイル: Program.cs プロジェクト: arieldeil/NCop
 public override void OnEntry(FunctionExecutionArgs <int> args)
 {
     base.OnEntry(args);
 }
コード例 #21
0
ファイル: Program.cs プロジェクト: arieldeil/NCop
 public override void OnSuccess(FunctionExecutionArgs <int, int, int, int> args)
 {
     Console.WriteLine("Code from TraceAspect3 OnSuccess");
     base.OnSuccess(args);
 }
コード例 #22
0
 public void OnException(FunctionExecutionArgs args)
 {
 }
コード例 #23
0
 public override void OnExit(FunctionExecutionArgs <int, int, int, string> args)
 {
     args.Arg3 = args.Arg2 = args.Arg1 += (int)AspectJoinPoints.OnExit;
     base.OnExit(args);
 }
コード例 #24
0
 public override void OnEntry(FunctionExecutionArgs <int, int, int, string> args)
 {
     args.FlowBehavior = FlowBehavior.Continue;
     args.Arg3         = args.Arg2 = args.Arg1 += (int)AspectJoinPoints.OnEntry;
     base.OnEntry(args);
 }
コード例 #25
0
 public override void OnEntry(FunctionExecutionArgs <int, int, int, string> args)
 {
     args.Arg3 = args.Arg2 = args.Arg1 += (int)AspectJoinPoints.OnEntry;
     args.AddToReturnValue(AspectJoinPoints.OnEntry);
     base.OnEntry(args);
 }
コード例 #26
0
 public void OnExit(FunctionExecutionArgs args)
 {
 }
コード例 #27
0
 public override void OnEntry(FunctionExecutionArgs <string, string> args)
 {
 }
コード例 #28
0
ファイル: Program.cs プロジェクト: arieldeil/NCop
 public override void OnExit(FunctionExecutionArgs <int, int, int, int> args)
 {
     Console.WriteLine("Code from TraceAspect3 OnExit");
     args.Arg1 = 10;
     base.OnExit(args);
 }
コード例 #29
0
 public override void OnEntry(FunctionExecutionArgs <int, bool> args)
 {
 }
コード例 #30
0
 // Implemented just to satisfy the interface
 public void OnSuccess(FunctionExecutionArgs args)
 {
 }