Пример #1
0
        public virtual object Intercept(object target, MethodBase method, object[] args)
        {
            if (!Client) method = CorrectMethod(target, method);
            var hookArgs = new CallHookArgs(target, method, args, Client);
            var list = Hooks(hookArgs).ToList();

            try
            {
                BeforeExecuteActions(target, method, args, list);
                hookArgs.Return = Invoke(target, method, args);
                AfterExecuteActions(target, method, args, list);

                return hookArgs.Return;
            }
            finally
            {
                FinallyExecuteActions(method, list);
            }
        }
Пример #2
0
        public virtual object Intercept(object target, MethodBase method, object[] args)
        {
            if (!Client) method = CorrectMethod(target, method);
            var hookArgs = new CallHookArgs(target, method, args, Client);
            var methodHooks = Hooks(hookArgs);

            ILog logger = Simply.Do.Log(this);

            var list = new List<ICallHook>(methodHooks);

            try
            {
                foreach (var hook in Enumerable.Reverse(list)) hook.Before();

                logger.DebugFormat("Calling {0} in {1}...", method.Name, method.DeclaringType.Name);

                if (Client) HeaderHandler.InjectCallHeaders(target, method, args);
                else HeaderHandler.RecoverCallHeaders(target, method, args);

                hookArgs.Return = Invoke(target, method, args);

                if (Client) HeaderHandler.RecoverCallHeaders(target, method, args);
                else HeaderHandler.InjectCallHeaders(target, method, args);

                logger.DebugFormat("Returning from {0} in {1}...", method.Name, method.DeclaringType.Name);

                foreach (var hook in list) hook.AfterSuccess();

                return hookArgs.Return;
            }
            finally
            {
                logger.DebugFormat("Finalizing {0} in {1}...", method.Name, method.DeclaringType.Name);

                foreach (var hook in list) hook.Finally();
            }
        }
Пример #3
0
 public HttpIdentityInjector(CallHookArgs args)
     : base(args)
 {
 }
Пример #4
0
 public WindowsIdentityInjector(CallHookArgs args)
     : base(args)
 {
 }
Пример #5
0
 protected BaseCallHook(CallHookArgs args)
 {
     this.CallArgs = args;
 }
Пример #6
0
 public DefaultCallHook(CallHookArgs args, object key)
     : base(args)
 {
     this.ConfigKey = key;
 }
Пример #7
0
 public Set9998BeforeHook(CallHookArgs args)
     : base(args)
 {
 }
Пример #8
0
 public Set9998AfterHook(CallHookArgs args)
     : base(args)
 {
 }
Пример #9
0
 public AddOneHook(CallHookArgs args)
     : base(args)
 {
 }