public Task <S> InvokeFuncAsync <S>(MethodInfo targetMethod, object[] args) { var interceptor = _interceptorFactory(targetMethod); if (interceptor is null) { return(_inner.InvokeFuncAsync <S>(targetMethod, args)); } return(WeavingInvoke()); async Task <S> WeavingInvoke() { using ( interceptor ) { var result = default(S); interceptor.BeforeCall(args); try { result = await _inner.InvokeFuncAsync <S>(targetMethod, args); } catch (Exception e) { interceptor.OnError(e); throw; } interceptor.AfterCompletion(result); return(result); } } }
public async Task <S> InvokeFuncAsync <S>(MethodInfo targetMethod, object[] args) { var delays = _retryStrategy.Delays.GetEnumerator(); for (; ;) { try { return(await _inner.InvokeFuncAsync <S>(targetMethod, args)); } catch (Exception e) when(WillRetry(e, delays)) { await Task.Delay(delays.Current); } } }
public override object InvokeFuncAsync(IMethodInvoker weaver, MethodInfo targetMethod, object[] args) => weaver.InvokeFuncAsync <S>(targetMethod, args);