Пример #1
0
        public RpcModule(IRpcServiceResolver rpcServiceResolver)
        {
            if (rpcServiceResolver == null)
            {
                throw new ArgumentNullException("rpcServiceResolver");
            }

            _rpcServiceResolver = rpcServiceResolver;
        }
Пример #2
0
        public RpcModule(string modulePath, IRpcServiceResolver rpcServiceResolver)
            : base(modulePath)
        {
            if (rpcServiceResolver == null)
            {
                throw new ArgumentNullException("rpcServiceResolver");
            }

            _rpcServiceResolver = rpcServiceResolver;
        }
Пример #3
0
 private void AddEndpoint <TRequest, TResponse>(IRpcServiceResolver rpcServiceResolver)
     where TRequest : class, new()
     where TResponse : class, new()
 {
     Post[typeof(TRequest).Name, true] = async(ctx, ct) =>
     {
         IRpcService <TRequest, TResponse> rpcService = rpcServiceResolver.GetRpcService <TRequest, TResponse>();
         var request = this.Bind <TRequest>();
         return(await rpcService.Execute(request, ct));
     };
 }
Пример #4
0
 private void AddEndpoint <TRequest, TResponse>(IRpcServiceResolver rpcServiceResolver)
     where TRequest : class, new()
     where TResponse : class, new()
 {
     Post("/" + typeof(TRequest).GetCustomAttributes <RpcMethodAttribute>().First().MethodName,
          async(ctx, ct) =>
     {
         var rpcService  = rpcServiceResolver.GetRpcService <TRequest, TResponse>();
         var rpcRequest  = Bind <TRequest>();
         var rpcResponse = await rpcService.Execute(rpcRequest, ct);
         return(this.Response.AsJson(rpcResponse));
     });
 }
Пример #5
0
 public HelloServiceModule(IRpcServiceResolver rpcServiceResolver)
     : base(rpcServiceResolver)
 {
     RegisterRpcServices();
 }
 public TestRpcModule(IRpcServiceResolver rpcServiceResolver)
     : base("rpc", rpcServiceResolver)
 {
 }
Пример #7
0
 public SimpleRpcModule(IRpcServiceResolver rpcServiceResolver)
 {
     _rpcServiceResolver = rpcServiceResolver;
 }