Exemplo n.º 1
0
        Task <TResult> IHubProxyOneWay <TServerHubInterface> .CallAsync <TResult>(
            Expression <Func <TServerHubInterface, Task <TResult> > > call)
        {
            ActionDetail invocation = call.GetActionDetails();

            return(_hubProxy.Invoke <TResult>(invocation.MethodName, invocation.Parameters));
        }
Exemplo n.º 2
0
        Task IHubProxyOneWay <TServerHubInterface> .CallAsync(
            Expression <Action <TServerHubInterface> > call)
        {
            ActionDetail invocation = call.GetActionDetails();

            return(_hubProxy.Invoke(invocation.MethodName, invocation.Parameters));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }