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; }); }
private async Task<ActivationContext> DoAfter(MethodAdviceContext context, ActivationContext ctx) { if (context.IsAwaitable()) { ctx = await AfterProcesssingAsync(ctx); } else { ctx = AfterProcesssing(ctx); } return ctx; }
private async Task<ActivationContext> DoBefore(MethodAdviceContext context) { ActivationContext ctx; if (context.IsAwaitable()) { ctx = await BeforeProcessingAsync(new ActivationContext(context)); } else { ctx = BeforeProcessing(new ActivationContext(context)); } return ctx; }