Tolitech.Domain.Specifications 1.0.0-preview.6

This is a prerelease version of Tolitech.Domain.Specifications.
There is a newer prerelease version of this package available.
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
                    
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="Tolitech.Domain.Specifications" Version="1.0.0-preview.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tolitech.Domain.Specifications" Version="1.0.0-preview.6" />
                    
Directory.Packages.props
<PackageReference Include="Tolitech.Domain.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 Tolitech.Domain.Specifications --version 1.0.0-preview.6
                    
#r "nuget: Tolitech.Domain.Specifications, 1.0.0-preview.6"
                    
#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 Tolitech.Domain.Specifications@1.0.0-preview.6
                    
#: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=Tolitech.Domain.Specifications&version=1.0.0-preview.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Tolitech.Domain.Specifications&version=1.0.0-preview.6&prerelease
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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