Code Monkey home page Code Monkey logo

grpcdemo-c-sharp's Introduction

grpcdemo-c-sharp

gRPC sample implementation of server and client in C#.

This is a little sample implementation of fictional "Phone book" register that shows some principles:

  • proto files
  • auto generated code from proto files
  • server implementation
  • implementation of simple singular request/response
  • implementation of stream response
  • easter egg - implementation of bi-directional stream

Contents

  • GrpcServer - gRPC server implementation in C#
  • GrpcConsoleClient - gRPC client implementation as a console application

Prerequisites

  • .net core 3.1 (or higher)
  • Visual Studio 16.4 (or higher)

How to open and run

Preparation in Visual Studio

Simply clone the repository and open sln in Visual Studio.

Right click on solution and go to Properties - navigate to Common properties - Startup Project.

Make sure that Multiple startup projects is selected, both projects (GrpcServer and GrpcConsoleClient) are set to Start.

Finally make sure that GrpcServer is the first in order to be run.

Run

Now you can just click on Start (or F5)

What will happen on a startup

  • gRPC server implementation in C#
  • gRPC client implementation in C# as a Console application
  • Phone book repository is a List that will on runtime auto generate 20 contact entries with random 1,2, or 3 phone numbers on each.

Data structure

  • collection of ContactModel objects
  • on every ContactModel there is collection of PhoneNumberModel objects

.proto files

.proto files are located in Protos folders in both solutions

Easter egg

Press 0 on the client to see 20 seconds of banter I'm not your buddy guy between server and client (demo of bi-directional stream)

References

grpcdemo-c-sharp's People

Contributors

lukastosic-ifd avatar lukastosic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.