public S InvokeFunc <S>(MethodInfo targetMethod, object[] args)
        {
            var interceptor = _interceptorFactory(targetMethod);

            if (interceptor is null)
            {
                return(_inner.InvokeFunc <S>(targetMethod, args));
            }
            using ( interceptor ) {
                S result = default;
                interceptor?.BeforeCall(args);
                try {
                    result = _inner.InvokeFunc <S>(targetMethod, args);
                } catch (Exception e) {
                    interceptor?.OnError(e);
                    throw;
                }
                interceptor?.AfterCompletion(result);
                return(result);
            }
        }
Ejemplo n.º 2
0
        public S InvokeFunc <S>(MethodInfo targetMethod, object[] args)
        {
            var delays = _retryStrategy.Delays.GetEnumerator();

            for (; ;)
            {
                try {
                    return(_inner.InvokeFunc <S>(targetMethod, args));
                } catch (Exception e) when(WillRetry(e, delays))
                {
                    Thread.Sleep(delays.Current);
                }
            }
        }
 public override object InvokeFunc(IMethodInvoker weaver, MethodInfo targetMethod, object[] args) =>
 weaver.InvokeFunc <S>(targetMethod, args);