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" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.Protocols.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 XiHan.Framework.Protocols.Grpc --version 5.0.0-preview.2
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.Protocols.Grpc&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Tool

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

更多文档

相关包

反馈与贡献

XiHan.Framework.Protocols.Grpc 以 MIT 许可证 开源。欢迎到 GitHub 仓库 提交问题和贡献。

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