Komair.Specifications
8.3.0
dotnet add package Komair.Specifications --version 8.3.0
NuGet\Install-Package Komair.Specifications -Version 8.3.0
<PackageReference Include="Komair.Specifications" Version="8.3.0" />
<PackageVersion Include="Komair.Specifications" Version="8.3.0" />
<PackageReference Include="Komair.Specifications" />
paket add Komair.Specifications --version 8.3.0
#r "nuget: Komair.Specifications, 8.3.0"
#:package Komair.Specifications@8.3.0
#addin nuget:?package=Komair.Specifications&version=8.3.0
#tool nuget:?package=Komair.Specifications&version=8.3.0
Komair.Specifications
A .NET implementation of the Specification pattern for building composable business rules.
Key Concepts
ISpecification<T>– abstraction for a predicate that can be combined and evaluatedAnd/Orwithparams– fold any number of specifications onto the receiver (e.g.mySpec.And(a, b)is equivalent to chainingmySpec.And(a).And(b); same idea forOr)TrueSpecification<T>.Identity/FalseSpecification<T>.Identity– neutral elements for those folds: true forAnd, false forOr- combinators –
And,Or, andNotspecifications for composing more complex rules - expression pipeline –
ToExpressionandWhereexposeExpression<Func<T, Boolean>>for use with LINQ providers
Starting from Identity
Use the always-true identity when you want “and together these specs” without an existing left-hand specification:
var spec = TrueSpecification<Order>.Identity.And(active, paid, notCancelled);
Use the always-false identity when you want “or together these specs” the same way:
var spec = FalseSpecification<Order>.Identity.Or(draft, archived, pendingReview);
With no extra arguments, TrueSpecification<T>.Identity.And() stays always true, and FalseSpecification<T>.Identity.Or() stays always false. You can still start from any other specification instead (e.g. active.And(paid, shipped)).
Typical Usage
Use specifications to encapsulate complex predicates, compose them fluently, and reuse them across repositories, query handlers, and validation layers.
Installation
dotnet add package Komair.Specifications
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.