/// <summary> /// Performs a synchronous RPC operation on the given service. /// </summary> /// <typeparam name="TService">The service being used.</typeparam> /// <param name="client">The client to use to invoke the RPC call.</param> /// <param name="operation">An expression indicating the operation to perform.</param> public static void Invoke <TService>( this ProtoClient <TService> client, Expression <Action <TService> > operation) where TService : class { Action updateArgs; object[] args; MethodInfo method = ResolveMethod <TService>(operation, out updateArgs, out args); client.Invoke(method, args); if (updateArgs != null) { updateArgs(); } }
/// <summary> /// Performs a synchronous RPC operation on the given service. /// </summary> /// <typeparam name="TService">The service being used.</typeparam> /// <typeparam name="TResult">The result of the RPC call.</typeparam> /// <param name="client">The client to use to invoke the RPC call.</param> /// <param name="operation">An expression indicating the operation to perform.</param> /// <returns>The value of the RPC call.</returns> public static TResult Invoke <TService, TResult>( this ProtoClient <TService> client, Expression <Func <TService, TResult> > operation) where TService : class { Action updateArgs; object[] args; MethodInfo method = ResolveMethod <TService>(operation, out updateArgs, out args); TResult result = (TResult)client.Invoke(method, args); if (updateArgs != null) { updateArgs(); } return(result); }