Example #1
0
        public static async Task Main(string[] args)
        {
            try
            {
                // register ICalculator proxy generated by ServiceModel.Grpc.DesignTime
                DefaultClientFactory.AddCalculatorClient();

                var nativeChannel       = new Channel("localhost", ServiceConfiguration.ServiceNativeGrpcPort, ChannelCredentials.Insecure);
                var serviceModelChannel = new Channel("localhost", ServiceConfiguration.ServiceModelGrpcPort, ChannelCredentials.Insecure);

                Console.WriteLine("Native->Native");
                await NativeCall(nativeChannel);

                Console.WriteLine();
                Console.WriteLine("ServiceModel->ServiceModel");
                await ServiceModelCall(serviceModelChannel);

                Console.WriteLine();
                Console.WriteLine("Native->ServiceModel");
                await NativeCall(serviceModelChannel);

                Console.WriteLine();
                Console.WriteLine("ServiceModel->Native");
                await ServiceModelCall(nativeChannel);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.WriteLine("...");
            Console.ReadLine();
        }