ApricotFramework.Grpc.Client.DiscoveryClient
0.1.0
Prefix Reserved
dotnet add package ApricotFramework.Grpc.Client.DiscoveryClient --version 0.1.0
NuGet\Install-Package ApricotFramework.Grpc.Client.DiscoveryClient -Version 0.1.0
<PackageReference Include="ApricotFramework.Grpc.Client.DiscoveryClient" Version="0.1.0" />
<PackageVersion Include="ApricotFramework.Grpc.Client.DiscoveryClient" Version="0.1.0" />
<PackageReference Include="ApricotFramework.Grpc.Client.DiscoveryClient" />
paket add ApricotFramework.Grpc.Client.DiscoveryClient --version 0.1.0
#r "nuget: ApricotFramework.Grpc.Client.DiscoveryClient, 0.1.0"
#:package ApricotFramework.Grpc.Client.DiscoveryClient@0.1.0
#addin nuget:?package=ApricotFramework.Grpc.Client.DiscoveryClient&version=0.1.0
#tool nuget:?package=ApricotFramework.Grpc.Client.DiscoveryClient&version=0.1.0
ApricotFramework.Grpc
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 | Versions 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. |
-
net10.0
- ApricotFramework.DiscoveryClient (>= 0.1.0)
- ApricotFramework.ErrorDefinitions (>= 0.1.0)
- ApricotFramework.Grpc.Client (>= 0.1.0)
- Google.Protobuf (>= 3.36.0)
- Grpc.Core.Api (>= 2.83.0)
- Grpc.Net.ClientFactory (>= 2.83.0)
- Grpc.StatusProto (>= 2.83.0)
- Microsoft.Extensions.Logging (>= 10.0.11)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.11)
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 | 99 | 8/23/2026 |