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); } }
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(); } }
public HttpIdentityInjector(CallHookArgs args) : base(args) { }
public WindowsIdentityInjector(CallHookArgs args) : base(args) { }
protected BaseCallHook(CallHookArgs args) { this.CallArgs = args; }
public DefaultCallHook(CallHookArgs args, object key) : base(args) { this.ConfigKey = key; }
public Set9998BeforeHook(CallHookArgs args) : base(args) { }
public Set9998AfterHook(CallHookArgs args) : base(args) { }
public AddOneHook(CallHookArgs args) : base(args) { }