HandlerR.Contracts 1.0.0

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

HandlerR.Contracts

为 .NET 10 共享项目提供零依赖的消息契约。

IBaseRequest
IRequest                        // 无响应请求标记
IRequest<TResponse>             // 有响应请求
INotification                   // 一对多通知
IStreamRequest<TResponse>       // 流式请求
Unit                            // 无值响应占位符

为什么单独拆包

API / gRPC / Blazor 等契约项目常常只需要"消息长什么样",不需要调度器、DI 与可观测性代码。 把这些标记接口与 Unit 独立成包后,契约项目只引用本包即可,依赖图保持单向直线:

HandlerR.Contracts  ←  HandlerR.Abstractions  ←  HandlerR.Core  ←  HandlerR.DependencyInjection

本包不含 Handler、Behavior、DI 或分发逻辑,也不做类型转发(没有历史包袱需要兼容)。

安装

dotnet add package HandlerR.Contracts --version 1.0.0

在面向 net10.0 的共享类库里定义消息和响应 DTO。

using HandlerR.Contracts;

public sealed record GetProduct(string Sku) : IRequest<ProductDto>;
public sealed record ProductDto(string Sku, decimal Price);
public sealed record OrderPlaced(int OrderId) : INotification;
public sealed record BrowseProducts(int Take) : IStreamRequest<ProductDto>;

宿主引用共享类库和 HandlerR 主包,在宿主或业务模块中实现这些消息的处理器,并向 DI 容器注册。主包会自动还原本契约包。 主包使用说明

许可

Apache-2.0。本库为独立实现,与 MediatR 无任何隶属或派生关系。

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.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on HandlerR.Contracts:

Package Downloads
HandlerR

In-process message dispatcher: requests, notifications, streaming, pipeline behaviors, exception mapping and built-in observability. Bundles HandlerR.Abstractions, HandlerR.Core and HandlerR.DependencyInjection, and ships the compile-time dispatch generator.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 0 11/24/2026