Tolitech.Domain.Specifications
1.0.0-preview.6
See the version list below for details.
dotnet add package Tolitech.Domain.Specifications --version 1.0.0-preview.6
NuGet\Install-Package Tolitech.Domain.Specifications -Version 1.0.0-preview.6
<PackageReference Include="Tolitech.Domain.Specifications" Version="1.0.0-preview.6" />
<PackageVersion Include="Tolitech.Domain.Specifications" Version="1.0.0-preview.6" />
<PackageReference Include="Tolitech.Domain.Specifications" />
paket add Tolitech.Domain.Specifications --version 1.0.0-preview.6
#r "nuget: Tolitech.Domain.Specifications, 1.0.0-preview.6"
#:package Tolitech.Domain.Specifications@1.0.0-preview.6
#addin nuget:?package=Tolitech.Domain.Specifications&version=1.0.0-preview.6&prerelease
#tool nuget:?package=Tolitech.Domain.Specifications&version=1.0.0-preview.6&prerelease
Tolitech.Domain.Specifications
Overview
Tolitech.Domain.Specifications implements the Specification pattern for .NET, enabling reusable, composable business rules and queries. It extends repository interfaces to support specification-based filtering and projections.
Features
- Specification Pattern: Encapsulate business rules and queries as specifications.
- Repository Extensions: Query entities using specifications and projections.
- Async Operations: All repository methods are asynchronous.
Installation
Add a reference to the Tolitech.Domain.Specifications project or install via NuGet:
dotnet add package Tolitech.Domain.Specifications
Usage
Specification Example
public class LegalAgeSpecification : Specification<Person>
{
public override Expression<Func<Person, bool>> ToExpression() => p => p.Age >= 18;
}
Repository Query Example
var spec = new LegalAgeSpecification();
List<Person> adults = await repository.ToListAsync(spec, CancellationToken.None);
Projection Example
var spec = new LegalAgeSpecification();
List<string> names = await repository.ToListAsync(spec, p => p.Name, CancellationToken.None);
Count & Existence
bool anyAdults = await repository.AnyAsync(spec, CancellationToken.None);
int count = await repository.CountAsync(spec, CancellationToken.None);
Notes
- Specifications can be combined for complex queries.
- Integrates seamlessly with Tolitech.Domain entities and repositories.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
-
net9.0
- Tolitech.Domain (>= 1.0.0-preview.8)
- Tolitech.Specifications (>= 1.0.0-preview.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Tolitech.Domain.Specifications:
Package | Downloads |
---|---|
Tolitech.Infrastructure.Persistence.EntityFrameworkCore.Specifications
The Tolitech.Infrastructure.Persistence.EntityFrameworkCore.Specifications repository provides a foundational implementation for the Specifications pattern. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0-preview.7 | 147 | 8/4/2025 |
1.0.0-preview.6 | 440 | 7/21/2025 |
1.0.0-preview.5 | 116 | 7/7/2025 |
1.0.0-preview.4 | 121 | 7/3/2025 |
1.0.0-preview.3 | 120 | 7/3/2025 |
1.0.0-preview.2 | 90 | 1/6/2025 |
1.0.0-preview.1 | 89 | 12/11/2024 |