public void Advise(MethodAdviceContext call) { if (_newParameter.HasValue) call.Parameters[0] = _newParameter.Value; call.Proceed(); if (_newReturnValue.HasValue) call.ReturnValue = _newReturnValue.Value; }
public void Advise(MethodAdviceContext context) { LastAdvicesCount = ++AdvicesCount[context]; if (RandomString[context] == null) RandomString[context] = "1"; else RandomString[context] += "0"; LastRandomString = RandomString[context]; context.Proceed(); }
void IMethodAdvice.Advise(MethodAdviceContext context) { if (context.IsAwaitable() && context.IsAsync()) AdviseAsync(context, async () => await context.ProceedAsync1()); else if (context.IsAwaitable()) AdviseAsync(context, context.ProceedAsync1); else AdviseSync(context, () => { context.Proceed(); return 1; }); }
public void Advise(MethodAdviceContext context) { var locked = Locked[context]; if (locked) return; try { Locked[context] = true; context.Proceed(); } finally { Locked[context] = false; } }
public void Advise(MethodAdviceContext context) { LastStaticAdvicesCount = ++StaticAdvicesCount[context]; context.Proceed(); }
public void Advise(MethodAdviceContext context) { // do things you want here context.Proceed(); // this calls the original method // do other things here }
public void Advise(MethodAdviceContext context) { context.Proceed(); }
public void Advise(MethodAdviceContext call) { Count++; call.Proceed(); }
public void Advise(MethodAdviceContext context) { context.Parameters[0] = (string)context.Parameters[0] + "E"; context.Proceed(); }
/// <summary> /// Implements advice logic. /// Usually, advice must invoke context.Proceed() /// </summary> /// <param name="context">The method advice context.</param> public void Advise(MethodAdviceContext context) { using (var t = TracerFactory.StartTracer(context.TargetType, context.TargetMethod.Name)) { try { context.Proceed(); } catch (Exception ex) { if (TreatExceptionAsInformational) { t.SetException(ex); } else t.SetErrorState(ex); } } }