static async Task MainAsync(string[] args) { using var channel = GrpcChannel.ForAddress($"{Constants.Protocol}://{Constants.Host}:{Constants.Port}"); var client = new MusicService.MusicServiceClient(channel); var reply = await client.GetAlbumDetailsAsync( new AlbumRequest { Artist = "HZ" }); Console.WriteLine($"Album : {reply.AlbumName}, released by : {reply.Label} on {reply.Year}"); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
static void Main(string[] args) { var channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure); var client = new MusicService.MusicServiceClient(channel); var request = new NotesRequest { Key = Note.C, Name = "Major" }; var response = client.Query(request); foreach (var note in response.Notes) { Console.WriteLine(note); } channel.ShutdownAsync().Wait(); Console.WriteLine("Press a key to exit"); Console.ReadKey(); }