Exemplo n.º 1
0
        public Employee GetEmployee()
        {
            //传入元数据
            var md = new Metadata
            {
                { "username", "jack" },
                { "role", "admin" }
            };

            using var channel = GrpcChannel.ForAddress("http://localhost:6001");
            var client = new EmployeeService.EmployeeServiceClient(channel);

            return(client.GetByNo(new GetByNoRequest
            {
                No = 1994
            }, md).Employee);
        }