Example #1
0
 static void AccountServiceRequest()
 {
     try
     {
         Channel      channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
         var          client  = new AccountService.AccountServiceClient(channel);
         EmployeeName empName = client.GetEmployeeName(new EmployeeNameRequest {
             EmpId = "1"
         });
         if (empName == null || string.IsNullOrWhiteSpace(empName.FirstName) || string.IsNullOrWhiteSpace(empName.LastName))
         {
             Console.WriteLine("Employee not found.");
         }
         else
         {
             Console.WriteLine($"The employee name is {empName.FirstName} {empName.LastName}.");
         }
         channel.ShutdownAsync().Wait();
         Console.WriteLine("AccountServiceRequest Terminated...");
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Exception encountered: {ex}");
     }
 }
Example #2
0
        public static void Main()
        {
            try
            {
                Channel channel = new Channel("192.168.237.130:50051", ChannelCredentials.Insecure);
                var     client  = new AccountService.AccountServiceClient(channel);

                EmployeeName empName = client.GetEmployeeName(new EmployeeNameRequest {
                    EmpId = "1"
                });

                if (empName == null || string.IsNullOrWhiteSpace(empName.FirstName) ||
                    string.IsNullOrWhiteSpace(empName.LastName))
                {
                    Console.WriteLine("Employee not found.");
                }
                else
                {
                    Console.WriteLine($"The employee name is {empName.FirstName} {empName.LastName}.");
                }
                channel.ShutdownAsync().Wait();
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception encountered: {ex}");
            }
        }
 public void RunBenchmark()
 {
     for (var x = 0; x < perfCount; ++x)
     {
         var empName = accClient.GetEmployeeName(new EmployeeNameRequest {
             EmpId = "1"
         });
     }
 }
 public void RunBenchmark()
 {
     var empName = accClient.GetEmployeeName(new EmployeeNameRequest {
         EmpId = "1"
     });
 }