Task <TResult> IHubProxyOneWay <TServerHubInterface> .CallAsync <TResult>( Expression <Func <TServerHubInterface, Task <TResult> > > call) { ActionDetail invocation = call.GetActionDetails(); return(_hubProxy.Invoke <TResult>(invocation.MethodName, invocation.Parameters)); }
Task IHubProxyOneWay <TServerHubInterface> .CallAsync( Expression <Action <TServerHubInterface> > call) { ActionDetail invocation = call.GetActionDetails(); return(_hubProxy.Invoke(invocation.MethodName, invocation.Parameters)); }
internal static ActionDetail GetActionDetails <T>(this Expression <Action <T> > action) { if (!(action.Body is MethodCallExpression)) { throw new ArgumentException(ERR_ACTION_MUST_BE_METHODCALL, "action"); } var callExpression = (MethodCallExpression)action.Body; var actionDetail = new ActionDetail { MethodName = callExpression.Method.Name, Parameters = callExpression.Arguments.Select(ConvertToConstant).ToArray(), }; return(actionDetail); }
internal static ActionDetail GetActionDetails <TInput, TResult>(this Expression <Func <TInput, TResult> > action) { if (!(action.Body is MethodCallExpression)) { throw new ArgumentException(ERR_ACTION_MUST_BE_METHODCALL, nameof(action)); } var callExpression = (MethodCallExpression)action.Body; var actionDetail = new ActionDetail { MethodName = callExpression.Method.Name, Parameters = callExpression.Arguments.Select(ConvertToConstant).ToArray(), ReturnType = typeof(TResult) }; return(actionDetail); }