Exemple #1
0
        protected override Task InterceptAsync(IInvocation invocation, Func <IInvocation, Task> proceed)
        {
            var invocationContext  = new DynamicProxyInvocationContext(invocation);
            InterceptDelegate next = context => proceed(invocation);

            return(_interceptor(next)(invocationContext));
        }
        protected override async Task <TResult> InterceptAsync <TResult>(IInvocation invocation, Func <IInvocation, Task <TResult> > proceed)
        {
            var invocationContext  = new DynamicProxyInvocationContext(invocation);
            InterceptDelegate next = context => proceed(invocation);

            await _interceptor(next)(invocationContext);

            return(((Task <TResult>)invocationContext.ReturnValue).Result);
        }