PouryaKit.Grpc 0.1.0-preview.2

This is a prerelease version of PouryaKit.Grpc.
dotnet add package PouryaKit.Grpc --version 0.1.0-preview.2
                    
NuGet\Install-Package PouryaKit.Grpc -Version 0.1.0-preview.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PouryaKit.Grpc" Version="0.1.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PouryaKit.Grpc" Version="0.1.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="PouryaKit.Grpc" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PouryaKit.Grpc --version 0.1.0-preview.2
                    
#r "nuget: PouryaKit.Grpc, 0.1.0-preview.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PouryaKit.Grpc@0.1.0-preview.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PouryaKit.Grpc&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PouryaKit.Grpc&version=0.1.0-preview.2&prerelease
                    
Install as a Cake Tool

PouryaKit.Grpc

NuGet .NET 10 License: MIT

PouryaKit.Grpc

gRPC on the same conventions as the Kit's HTTP endpoints. The .proto contract lives in the Module's Contracts, a service is declared in its Composition Root and mapped once in the Host, and each call runs through the Module's Gateway with the Operation Context the call began with. A failed Result answers a gRPC status chosen as HTTP chooses its status, with every Error in a trailer.

Install

dotnet add package PouryaKit.Grpc --prerelease

When to use it

  • Another Host asks a Module questions over gRPC rather than HTTP.
  • You write a Module's gRPC service from a Protobuf contract.
  • A client must read every Error of a failed call, not only its status.
  • A Host calls another Host with a client that carries the Operation Context and a deadline.

It builds on PouryaKit.Web, whose authentication and Operation Context it reuses.

Quick start

Declare the service in the Composition Root and map the services once in the Host:

module.AddPouryaKitGrpcService<ProductGrpcService>();
app.MapPouryaKitGrpcServices();

A service runs each call through the Gateway, as the Proving Sample's does:

internal sealed class ProductGrpcService(
    IGatewayProcessor<CatalogModule> catalog,
    OperationContext context
) : ProductService.ProductServiceBase
{
    public override async Task<ProductReply> GetProduct(
        GetProductRequest request,
        ServerCallContext call
    ) =>
        Guid.TryParse(request.ProductId, CultureInfo.InvariantCulture, out var productId)
            ? (
                await catalog.QueryAsync(
                    new GetProductQuery(productId),
                    context,
                    call.CancellationToken
                )
            ).ToGrpcResponse(product => new ProductReply
                {
                    Id = product.Id.ToString(),
                    CategoryId = product.CategoryId.ToString(),
                    Name = product.Name,
                }
            )
            : throw new RpcException(
                new Status(StatusCode.InvalidArgument, "product_id is not a Guid.")
            );
}

Another Host registers a client that carries the Operation Context under a name of its own, Client here, as the Kit's tests do. Configure the PouryaKitGrpcClientOptions of that name with its Address and Deadline, or the Host fails when it starts:

services.AddPouryaKitGrpcClient<ProductService.ProductServiceClient>(Client);

What you get

  • Each call an Operation, authenticated as an endpoint is.
  • A failed Result as a gRPC status, with every Error in a trailer a client can read.
  • Clients that carry the Operation Context in their call metadata, with a deadline from validated options.
  • A Host that fails when it starts if a declared service was never mapped.

gRPC without TLS needs an HTTP/2-only listener: a listener that serves both protocols without TLS negotiates no HTTP/2, so the Host needs one for gRPC beside the one REST clients reach.

Learn more

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.2 71 11/1/2026
0.1.0-preview.1 65 10/31/2026
0.1.0-preview.0.28 68 10/26/2026