Specifications for modern C# · zero third-party dependencies

Business rules that read like business rules.

Compose named rules with terse, discoverable syntax—then evaluate them in memory or hand them to infrastructure without leaking a query API.

NuGet · latestdotnet add package DanMarshall.FluentSpecifications
OrderSearch.csNo IQueryable
var request = Order.Search
    .Matching.CanShip.And.HighPriority
    .Sorted.By.CreatedAt.Desc
    .Then.By.Id.Asc
    .Page(2).OfSize(50);

Informed by the internal Kotlin API used at Reapit and established specification libraries across C#, Java, Kotlin, TypeScript, and PHP.

Read the design lineage

A deliberately small idea

Readable at the call site. Honest at the boundary.

01

Domain-first syntax

`CanShip.And.HighPriority` says what the rule means without ceremony or overloaded Boolean operators.

02

One rule tree

The same immutable specification supports fast matching, structured diagnostics, rendering, and translation.

03

No query leakage

Rules and immutable searches cross the boundary. EF Core stays in infrastructure and materializes results before returning.

The useful boundary

Boolean rules in. Materialized answers out.

A specification stays Boolean. A separate immutable search can add sorting and paging without leaking EF, `DbSet`, or `IQueryable`.

Understand the EF Core boundary