Sparkdo.Specifications 2.0.0-preview.1

This is a prerelease version of Sparkdo.Specifications.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Sparkdo.Specifications --version 2.0.0-preview.1
                    
NuGet\Install-Package Sparkdo.Specifications -Version 2.0.0-preview.1
                    
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="Sparkdo.Specifications" Version="2.0.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sparkdo.Specifications" Version="2.0.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Sparkdo.Specifications" />
                    
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 Sparkdo.Specifications --version 2.0.0-preview.1
                    
#r "nuget: Sparkdo.Specifications, 2.0.0-preview.1"
                    
#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 Sparkdo.Specifications@2.0.0-preview.1
                    
#: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=Sparkdo.Specifications&version=2.0.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Sparkdo.Specifications&version=2.0.0-preview.1&prerelease
                    
Install as a Cake Tool

Sparkdo.Specifications

Sparkdo.Specifications 提供 BCL-only 的领域规则表达与组合能力。

创建和组合

using Sparkdo.Specifications;

var adult = Specification.Named<Person>("Adult", person => person.Age >= 18);
var active = Specification.From<Person>(person => person.IsActive);

var activeAdult = adult.And(active);

activeAdult.IsSatisfiedBy(person);
query.Where(activeAdult);

Specification.PropertyEqualsSpecification.PropertySatisfies 可从属性 selector 创建规则;AllOfAnyOfNoneOf 可批量组合规则;AndIfOrIf 用于条件组合。

如需自定义实现,可直接实现 ISpecification<T>,或继承 Specification<T> 复用解释执行 predicate。组合结果公开 LeftRightInner,便于审计规则结构。

包边界

该包不依赖 Sparkdo Runtime、Hosting、EF Core、ASP.NET Core、Repository、UOW 或 Data,也不负责 provider 翻译、分页、排序、Include 或 tracking。

验证

dotnet restore src/specifications/Sparkdo.Specifications.slnx
dotnet build src/specifications/Sparkdo.Specifications.slnx --no-restore -p:UseSharedCompilation=false -nr:false
dotnet test src/specifications/Sparkdo.Specifications.slnx --filter "Gate!=PackageAsset" --no-restore -p:UseSharedCompilation=false -nr:false
dotnet pack src/specifications/Sparkdo.Specifications.slnx -c Release -p:UseSharedCompilation=false -nr:false
dotnet test src/specifications/Sparkdo.Specifications.slnx --filter "Gate=PackageAsset" --no-restore -p:UseSharedCompilation=false -nr:false
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 Sparkdo.Specifications:

Package Downloads
Sparkdo.Ddd.Domain

Sparkdo DDD 领域模型库,提供领域驱动设计的核心组件实现

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0-preview.2 43 7/20/2026
2.0.0-preview.1 46 7/18/2026
1.0.4-preview.3 175 6/8/2026
1.0.4-preview.2 164 6/7/2026
1.0.4-preview.1 173 6/7/2026
1.0.3 375 6/6/2026
1.0.3-preview.1 167 5/17/2026
1.0.2 320 4/27/2026
1.0.2-preview.5 101 4/15/2026
1.0.2-preview.4 113 2/8/2026
1.0.2-preview.3 118 2/1/2026
1.0.2-preview.2 127 1/31/2026
1.0.2-preview.1 196 12/4/2025
1.0.1 821 11/27/2025
1.0.0 775 11/25/2025
1.0.0-preview.5 150 10/24/2025