Skip to content

foondook/GrpcEndpoints

Repository files navigation

GrpcEndpoints

NuGet NuGet License: 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))]
public class SayHello : IGrpcEndpoint<HelloRequest, HelloReply>
{
    public Task<HelloReply> ExecuteAsync(HelloRequest request, ServerCallContext context, CancellationToken cancellationToken)
    {
        return Task.FromResult(new HelloReply
        {
            Message = $"Hello {request.Name} from GrpcEndpoints!"
        });
    }
}

2. Register endpoints and services

// Program.cs
builder.Services.AddGrpcEndpoints();

3. Map dynamic services

// Program.cs
app.MapGrpcEndpoints<Greeter.GreeterBase>();

License

MIT

About

Endpoint-based gRPC services for .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages