Example #1
0
        public StructType Method_M_V()
        {
            var call = new RpcCallParameters();

            call.ServiceName = TestServiceInterface_Proxy.ServiceName;
            call.MethodName  = "Method_M_V";
            var result = this.client.CallService(call);

            if (result.Status != RpcStatus.Succeeded)
            {
                throw new Exception(); // TODO: Be more specific
            }

            var returnValue = new StructType();

            returnValue.MergeFrom(result.ResultData);
            return(returnValue);
        }
Example #2
0
        public void CallMethod(IServerContext context, IRpcCall rpcCall, IRpcResult rpcResult)
        {
            rpcResult.Status = RpcStatus.Succeeded;

            if (rpcCall.MethodName == "Method_V_V")
            {
                this.Impl.Method_V_V(context);
            }
            else if (rpcCall.MethodName == "Method_V_M")
            {
                var input = new StructType();
                input.MergeFrom(new CodedInputStream(rpcCall.CallData));
                this.Impl.Method_V_M(context, input);
                rpcResult.ResultData = new Empty().ToByteArray();
            }
            else if (rpcCall.MethodName == "Method_M_V")
            {
                var result = this.Impl.Method_M_V(context);
                rpcResult.ResultData = result.ToByteArray();
            }
            else if (rpcCall.MethodName == "Method_M_M")
            {
                var input = new StructType();
                input.MergeFrom(new CodedInputStream(rpcCall.CallData));
                var result = this.Impl.Method_M_M(context, input);
                rpcResult.ResultData = result.ToByteArray();
            }
            else if (rpcCall.MethodName == "AsyncMethod_V_V")
            {
                this.Impl.AsyncMethod_V_V(context);
            }
            else if (rpcCall.MethodName == "AsyncMethod_V_M")
            {
                var input = new StructType();
                input.MergeFrom(new CodedInputStream(rpcCall.CallData));
                this.Impl.AsyncMethod_V_M(context, input);
            }
            else
            {
                rpcResult.Status = RpcStatus.UnknownMethod;
            }
        }