From b263a01a38c653ce6a3d2752b222226dcdaa4592 Mon Sep 17 00:00:00 2001 From: Vikrant Saxena <104590555+VSVanadium@users.noreply.github.com> Date: Mon, 18 Dec 2023 13:55:08 +0100 Subject: [PATCH] Create README.md --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8554063 --- /dev/null +++ b/README.md @@ -0,0 +1,51 @@ +The solution contains two solutions +1. OrderService (gRPC service) +2. Consumer ( Console Application) + +## OrderService + +Open the Protos\order.proto file and define your service: +every new method you define here will be avaliable for implementation under your Service class + +Implement the service logic: +Open the Services\OrderService.cs file and implement the endpoint defined in proto file. + +Open proto file properties +Build action: Protobuf compiler +gRPC Stub class: server only + +![Image Alt Text](/Images/2023-12-15%2013_33_14-.png) + +## Consumer + +Add in csproj file: +``` + + + + + +``` + +Add refernec to your server project + +Add proto file +in properties: +Build action: Protobuf compiler +gRPC Stub class: client only + +Create Channel +using var channel = GrpcChannel.ForAddress("http://localhost:5039") #your uri to service, configure in appsettings + +Create Client +var client = new Order.OrderClient(channel); + +Call Method +var request = new BillingRequest { Name = name, Product = "Bread", Quantity = quantity }; +var response = client.Checkout(request); + +Now, Run both the projects and give inputs to the prompts on the console: + +![Image Alt Text](/Images/2023-12-15%2013_42_08-Microsoft%20Visual%20Studio%20Debug%20Console.png) + +