Exemplo n.º 1
0
    public override async Task InterceptAsync(IAbpMethodInvocation invocation)
    {
        var context = new ClientProxyRequestContext(
            await GetActionApiDescriptionModel(invocation),
            invocation.ArgumentsDictionary,
            typeof(TService));

        if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty())
        {
            await InterceptorClientProxy.CallRequestAsync(context);
        }
        else
        {
            var returnType = invocation.Method.ReturnType.GenericTypeArguments[0];
            var result     = (Task)CallRequestAsyncMethod
                             .MakeGenericMethod(returnType)
                             .Invoke(this, new object[] { context });

            invocation.ReturnValue = await GetResultAsync(result, returnType);
        }
    }
Exemplo n.º 2
0
 protected virtual async Task <T> CallRequestAsync <T>(ClientProxyRequestContext context)
 {
     return(await InterceptorClientProxy.CallRequestAsync <T>(context));
 }