XiHan.Framework.Domain 5.0.0-preview.2

Prefix Reserved
This is a prerelease version of XiHan.Framework.Domain.
dotnet add package XiHan.Framework.Domain --version 5.0.0-preview.2
                    
NuGet\Install-Package XiHan.Framework.Domain -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.Domain" 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.Domain" Version="5.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="XiHan.Framework.Domain" />
                    
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.Domain --version 5.0.0-preview.2
                    
#r "nuget: XiHan.Framework.Domain, 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.Domain@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.Domain&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=XiHan.Framework.Domain&version=5.0.0-preview.2&prerelease
                    
Install as a Cake Tool

XiHan.Framework.Domain

关于

XiHan.Framework.Domain 定义领域模型的契约:实体与聚合根、领域事件、值对象、持久化自动维护字段的协议接口,以及可组合的查询规约。只有接口与零依赖的组合器,没有实体基类,按需组合协议即可。

主要特性

  • IEntity<TKey>、IAggregateRoot<TKey> 标识与聚合根
  • DomainEventBuffer 收集并清空领域事件
  • 软删除、创建/修改时间、多租户、并发戳等协议,持久化提供程序按协议维护
  • Specification<T> 支持 And / Or / Not 组合

如何使用

安装

dotnet add package XiHan.Framework.Domain --prerelease

使用

通常由持久化等抽象包带入;业务代码里让实体实现需要的协议:

public sealed class Order : IAggregateRoot<Guid>, IMultiTenant, ISoftDeletable, IHasCreationTime
{
    private readonly DomainEventBuffer _events = new();
    public Guid Id { get; init; }
    public string TenantId { get; set; } = string.Empty;
    public bool IsDeleted { get; set; }
    public DateTimeOffset? DeletedAt { get; set; }
    public DateTimeOffset CreatedAt { get; set; }
    public IReadOnlyList<IDomainEvent> DomainEvents => _events.Items;
    public void ClearDomainEvents() => _events.Clear();
}

主要类型

此库提供的主要类型:

  • IEntity<TKey>、IAggregateRoot<TKey>
  • IDomainEvent、IHasDomainEvents、DomainEventBuffer
  • ISoftDeletable、IHasCreationTime、IHasModificationTime、IMultiTenant、IHasConcurrencyStamp
  • IValueObject:值对象标记,用 record 获得值相等
  • ISpecification<T>、Specification<T>、Specification:查询规约

更多文档

相关包

反馈与贡献

XiHan.Framework.Domain 以 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 (4)

Showing the top 4 NuGet packages that depend on XiHan.Framework.Domain:

Package Downloads
XiHan.Framework.Data

曦寒框架数据访问库

XiHan.Framework.Application

曦寒框架领域驱动应用库

XiHan.Framework.Persistence.Abstractions

曦寒框架持久化抽象包

XiHan.Framework.Profiles.Standard

曦寒框架 Standard 组合包

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on XiHan.Framework.Domain:

Repository Stars
XiHanFun/XiHan.BasicApp
A beautifully crafted general-purpose admin kernel built on XiHan.Framework and XiHan.UI. The basic application of the XiHanFun open-source ecosystem.
Version Downloads Last Updated
5.0.0-preview.2 0 11/6/2026
5.0.0-preview.1 76 11/4/2026
4.8.0 191 10/22/2026
4.7.1 134 10/21/2026
4.7.0 170 10/15/2026
4.6.2 168 10/13/2026
4.6.1 347 10/3/2026
4.6.0 162 9/25/2026
4.5.0 144 9/23/2026
4.4.0 149 9/22/2026
4.3.0 165 9/12/2026
4.2.0 201 9/4/2026
4.1.0 172 8/31/2026
4.0.0 170 8/28/2026
3.14.0 174 8/26/2026
3.13.0 191 8/15/2026
3.12.1 154 8/14/2026
3.12.0 436 8/13/2026
3.11.1 160 8/11/2026
3.11.0 399 8/11/2026
Loading failed