Skip to content

Repository files navigation

GrpcEndpoints

NuGetNuGetLicense: MIT.NET

GrpcEndpoints is a lightweight framework that simplifies gRPC service implementation in .NET by using an endpoint-centric approach. It eliminates boilerplate code through attribute-based mapping and dynamic service generation, allowing developers to focus on implementing business logic rather than repetitive service scaffolding.

Features

  • ✅ Eliminate boilerplate service implementation classes
  • ✅ Attribute-based mapping of endpoints to gRPC methods
  • ✅ Automatic registration of endpoints with dependency injection
  • ✅ Dynamic creation of gRPC service implementations
  • ✅ Cleaner separation of concerns with endpoint-focused architecture

Installation

dotnet add package GrpcEndpoints

Quick Start

1. Define a gRPC endpoint

[GrpcEndpoint(typeof(Greeter.GreeterBase),nameof(Greeter.GreeterBase.SayHello))]publicclassSayHello:IGrpcEndpoint<HelloRequest,HelloReply>{publicTask<HelloReply>ExecuteAsync(HelloRequestrequest,ServerCallContextcontext,CancellationTokencancellationToken){returnTask.FromResult(newHelloReply{Message=$"Hello {request.Name} from GrpcEndpoints!"});}}

2. Register endpoints and services

// Program.csbuilder.Services.AddGrpcEndpoints();

3. Map dynamic services

// Program.csapp.MapGrpcEndpoints<Greeter.GreeterBase>();

License

MIT

About

Endpoint-based gRPC services for .NET

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages