XiHan.Framework.Protocols.Grpc
5.0.0-preview.2
Prefix Reserved
This is a prerelease version of XiHan.Framework.Protocols.Grpc.
dotnet add package XiHan.Framework.Protocols.Grpc --version 5.0.0-preview.2
NuGet\Install-Package XiHan.Framework.Protocols.Grpc -Version 5.0.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="XiHan.Framework.Protocols.Grpc" Version="5.0.0-preview.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XiHan.Framework.Protocols.Grpc" Version="5.0.0-preview.2" />
<PackageReference Include="XiHan.Framework.Protocols.Grpc" />
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 XiHan.Framework.Protocols.Grpc --version 5.0.0-preview.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XiHan.Framework.Protocols.Grpc, 5.0.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 XiHan.Framework.Protocols.Grpc@5.0.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=XiHan.Framework.Protocols.Grpc&version=5.0.0-preview.2&prerelease
#tool nuget:?package=XiHan.Framework.Protocols.Grpc&version=5.0.0-preview.2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XiHan.Framework.Protocols.Grpc
关于
XiHan.Framework.Protocols.Grpc gRPC 协议适配器:把标记为 Expose.Grpc 的操作发布为 gRPC 一元方法。protobuf 线格式由操作的 JSON Schema 推出,不需要编译 .proto,.proto 文件由同一份描述生成并经端点发布给客户端。
主要特性
- 一份操作契约同时在 gRPC 上服务,经完整内核管道
- 错误按 KIND 映射为 gRPC 状态,错误码与 trace-id 放在尾部元数据
GET /operations.proto发布.proto文件
如何使用
安装
dotnet add package XiHan.Framework.Protocols.Grpc --prerelease
使用
注册特性并映射端点;gRPC 需要 Kestrel 的 HTTP/2 端点。
builder.AddXiHan(xihan => xihan
.UseStandardProfile()
.UseFeature<GrpcProtocolFeature>());
var app = builder.Build();
app.UseXiHan();
app.MapXiHanGrpc(); // /Orders/Create、/Orders/List …
app.MapXiHanProto(); // GET /operations.proto
{ "Kestrel": { "Endpoints": { "Grpc": { "Url": "http://localhost:5001", "Protocols": "Http2" } } } }
主要类型
此库提供的主要类型:
GrpcProtocolFeature:特性入口GrpcProtocolOptions:Package、Methods(覆盖推导出的服务与方法名)OperationGrpcEndpointRouteBuilderExtensions:MapXiHanGrpc、MapXiHanProto
更多文档
相关包
- HTTP 协议适配器:XiHan.Framework.Protocols.Http
- MCP 协议适配器:XiHan.Framework.Protocols.Mcp
- CloudEvents 协议适配器:XiHan.Framework.Protocols.CloudEvents
反馈与贡献
XiHan.Framework.Protocols.Grpc 以 MIT 许可证 开源。欢迎到 GitHub 仓库 提交问题和贡献。
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Grpc.AspNetCore.Server (>= 2.85.0)
- Grpc.Core.Api (>= 2.85.0)
- XiHan.Framework.Hosting.AspNetCore (>= 5.0.0-preview.2)
- XiHan.Framework.Kernel (>= 5.0.0-preview.2)
- XiHan.Framework.Localization.Abstractions (>= 5.0.0-preview.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on XiHan.Framework.Protocols.Grpc:
| Package | Downloads |
|---|---|
|
XiHan.Framework.Profiles.Full
曦寒框架 Full 组合包 |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0-preview.2 | 0 | 11/6/2026 |
| 5.0.0-preview.1 | 43 | 11/4/2026 |