ApricotFramework.Grpc.Client 0.1.0

Prefix Reserved
dotnet add package ApricotFramework.Grpc.Client --version 0.1.0
                    
NuGet\Install-Package ApricotFramework.Grpc.Client -Version 0.1.0
                    
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="ApricotFramework.Grpc.Client" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApricotFramework.Grpc.Client" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ApricotFramework.Grpc.Client" />
                    
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 ApricotFramework.Grpc.Client --version 0.1.0
                    
#r "nuget: ApricotFramework.Grpc.Client, 0.1.0"
                    
#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 ApricotFramework.Grpc.Client@0.1.0
                    
#: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=ApricotFramework.Grpc.Client&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ApricotFramework.Grpc.Client&version=0.1.0
                    
Install as a Cake Tool

ApricotFramework.Grpc

NuGet NuGet NuGet NuGet NuGet CI License

A gRPC hop that keeps the error. A service throws a classified error; its caller catches the same error, with the same kind, code and payload, as though the call had been local.

Everything is opt-in and separately installable — errors, discovery, credentials — so a client takes what it needs and nothing else. Only the server package requires ASP.NET Core.

Install

dotnet add package ApricotFramework.Grpc.Server                    # the server
dotnet add package ApricotFramework.Grpc.Client                    # the caller
dotnet add package ApricotFramework.Grpc.Client.DiscoveryClient    # ...addressed by service name
dotnet add package ApricotFramework.Grpc.Client.Authentication     # ...presenting its own token

Usage

// Server. AddGrpc stays gRPC's own; this says what happens when a call fails, asking the same
// exception mappers that already answer this service's HTTP requests.
builder.Services.AddGrpc();
builder.Services.AddGrpcErrorHandling();
// Anywhere in a service method. Nothing catches this; the caller receives it.
throw Err.NotFound("ORDER_NOT_FOUND", $"no order with id '{id}'",
    new Dictionary<string, object?> { ["orderId"] = id }).AsException();
// Caller. Each line is a capability, and any of them can be left out.
builder.Services.AddGrpcClientsCore(builder.Configuration);
builder.Services.AddGrpcErrorMapping();

builder.Services
    .AddDiscoveredGrpcClient<Orders.OrdersClient>("orders")
    .AddGrpcCallCredentials(credentials => credentials.Scopes = ["orders.read"]);
try
{
    var order = await client.GetOrderAsync(new GetOrderRequest { Id = id });
}
catch (ErrorDefinitionException failure) when (failure.HasKind(ErrorKinds.NotFound))
{
    // The kind, the code and the payload are the ones the orders service threw.
}

Note. Errors travel in a trailer, and a trailer too large for the peer fails the whole response. They are therefore trimmed to a byte budget — payloads first, then the errors after the first — with a flag on the wire saying so. The server's log always holds the full set.

The wire contract is apricot.errors.v1, packed into the contract package as protos/apricot/errors/v1/errors.proto so a service in another language can speak it.

Full documentation at projectapricot.dev.

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 (2)

Showing the top 2 NuGet packages that depend on ApricotFramework.Grpc.Client:

Package Downloads
ApricotFramework.Grpc.Client.Authentication

Presents this service's own access token on outbound gRPC calls, obtained through ApricotFramework.Authentication, and reports a failure to obtain one as a fault of this service rather than of whoever called it.

ApricotFramework.Grpc.Client.DiscoveryClient

Addresses gRPC clients by logical service name, resolving them through ApricotFramework.DiscoveryClient so a caller names the service it wants rather than a host and port.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 122 8/23/2026