Example #1
0
        private static void InterceptSynchronousResult <TResult>(AsyncInterceptor me, IInvocation invocation)
        {
            Task task = me.InterceptAsync(invocation, ProceedSynchronous <TResult>);

            if (!task.IsCompleted)
            {
                Task.Run(() => task).Wait();
            }

            if (task.IsFaulted)
            {
                throw task.Exception.InnerException;
            }
        }
Example #2
0
 private static void HandleAsyncWithResult <TResult>(IInvocation invocation,
                                                     AsyncInterceptor asyncInterceptor)
 {
     asyncInterceptor.InterceptAsynchronous <TResult>(invocation);
 }