示例#1
0
 public static object InvokeServiceOperation(this IAppProvider appProvider, RequestInfo ri)
 {
     object srv = appProvider.GetService(ri.ServiceName);
     System.Reflection.MethodInfo mi = srv.GetType().GetMethod(ri.OperationName); // todo1[ak] cache this stuff
     object res = mi.Invoke(srv, ri.Args);
     return res;
 }
示例#2
0
        public RequestInfo DeserializeRequest(byte[] reqBytes)
        {
            using (MemoryStream reqStream = new MemoryStream(reqBytes))
            {
                RequestHeaderDto reqHeader = Serializer.DeserializeWithLengthPrefix<RequestHeaderDto>(reqStream, ProtoBuf.PrefixStyle.Base128, 1);

                string serviceName = reqHeader.ServiceName;
                string operationName = reqHeader.OperationName;
                object[] args = this.DeserializeArgs(serviceName, operationName, reqStream);

                RequestInfo ri = new RequestInfo
                {
                    ServiceName = serviceName,
                    OperationName = operationName,
                    Args = args,
                };

                return ri;
            }
        }