public void InvokeAction(MethodInfo targetMethod, object[] args)
        {
            var interceptor = _interceptorFactory(targetMethod);

            if (interceptor is null)
            {
                _inner.InvokeAction(targetMethod, args);
                return;
            }
            using ( interceptor ) {
                interceptor?.BeforeCall(args);
                try {
                    _inner.InvokeAction(targetMethod, args);
                } catch (Exception e) {
                    interceptor?.OnError(e);
                    throw;
                }
                interceptor?.AfterCompletion();
            }
        }
Exemple #2
0
        public void InvokeAction(MethodInfo targetMethod, object[] args)
        {
            var delays = _retryStrategy.Delays.GetEnumerator();

            for (; ;)
            {
                try {
                    _inner.InvokeAction(targetMethod, args);
                    return;
                } catch (Exception e) when(WillRetry(e, delays))
                {
                    Thread.Sleep(delays.Current);
                }
            }
        }