Beispiel #1
0
        public Task <RpcResult <SumRes> > SumAsync(SumReq req)
        {
            var result = new RpcResult <SumRes> {
                Data = new SumRes()
            };

            result.Data.Total = req.A + req.B;

            Logger.LogInformation("A+B=C {A}+{B}={C}", req.A, req.B, result.Data.Total);

            return(Task.FromResult(result));
        }
Beispiel #2
0
        public async Task <RpcResult <SumRes> > SumAsync(SumReq req)
        {
            RpcResult <SumRes> result = new RpcResult <SumRes> {
                Data = new SumRes()
            };

            result.Data.Total = req.A + req.B;

            var fooService = this._clientProxy.Create <IFooService>();
            var fooResult  = await fooService.FooAsync(new FooReq { FooWord = "Foo" });

            if (fooResult.Code != 0)
            {
                result.Code = fooResult.Code;
                return(result);
            }
            result.Data.FooWord = fooResult.Data?.RetWord;

            this._logger.LogInformation("A+B=C {A}+{B}={C}", req.A, req.B, result.Data.Total);
            return(result);
        }