EricksonLopez.Specification
dotnet-specification · Querying & Data
On this page (20 sections)
1. Identity, Tier & Maturity Profile#
2. Value Proposition & Problem Solved#
A high-performance, AOT-first, zero-reflection, zero-allocation specification pattern implementation for modern .NET, powered by Roslyn Incremental Source Generators
Traditional specification libraries call Expression.Compile() at runtime, breaking Native AOT, or leak ORM Include/AsNoTracking concerns into the Domain layer.
3. Quick Install#
Primary package: EricksonLopez.Specification
dotnet add package EricksonLopez.Specification --version 2.0.0<PackageReference Include="EricksonLopez.Specification" Version="2.0.0" /><PackageVersion Include="EricksonLopez.Specification" Version="2.0.0" />4. Verified Ecosystem Metrics#
Snapshot retrieved UTC: 2026-12-01
5. When to Use & When Not to Use#
When to use
- You want pure Domain Specification<T> predicates paired with multi-dialect SQL AST translation or EF Core/MongoDB adapters.
When NOT to use
- You only execute static pre-written SQL queries without reusable predicate composition—use EricksonLopez.SqlBuilder directly.
6. Core Capabilities & Design Invariants#
Trimming-Safe Expression Evaluation
Supports interpreted expression evaluation, bounded QueryPlanCache, and Span-based AndAll/OrAny composition.
Multi-Dialect SQL & Keyset Support
Translates QuerySpec<T> across PostgreSQL, SQL Server, MySQL, MariaDB, SQLite, and Oracle with SeekAfter/SeekBefore.
7. Included NuGet Packages & Adapters#
| Package ID | Status | NuGet / Local | TFMs | AOT Status | Downloads | Description |
|---|---|---|---|---|---|---|
| EricksonLopez.SpecificationPrimary | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 542 | Core Specification Pattern implementation for .NET 10+. AOT-first, allocation-conscious, DDD-compatible. Includes expression engine, composition, simplification, and structural hashing. |
| EricksonLopez.Specification.Abstractions | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 636 | Pure domain-level specification abstractions. Zero infrastructure dependencies. AOT-safe interfaces for ISpecification<T>, IExpressionSpecification<T>, and QuerySpec<T>. |
| EricksonLopez.Specification.Sql | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 476 | SQL generation layer for EricksonLopez.Specification. Translates QuerySpec<T> to a provider-agnostic SQL AST and parameterized SQL strings. No EF Core or Dapper dependency. |
| EricksonLopez.Specification.Linq | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 336 | LINQ/IQueryable integration for EricksonLopez.Specification. Applies QuerySpec<T> to IQueryable<T> sources. Compatible with EF Core, LINQ to Objects, and any IQueryable provider. |
| EricksonLopez.Specification.Dapper | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Incompatible | 304 | Dapper integration for EricksonLopez.Specification. Execute QuerySpec<T> against IDbConnection using parameterized SQL generated by the SQL translation layer. |
| EricksonLopez.Specification.DapperExtensions | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Incompatible | 291 | DapperExtensions integration for EricksonLopez.Specification. Enables executing domain specifications over IDbConnection and IUnitOfWork. |
| EricksonLopez.Specification.MariaDb | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 288 | MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MariaDB-compatible SQL (backtick quoting, @parameters, LIMIT/OFFSET, expanded IN). |
| EricksonLopez.Specification.EntityFrameworkCore | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 285 | Entity Framework Core integration for EricksonLopez.Specification. Provides specification evaluation and asynchronous read repository implementations for EF Core. |
| EricksonLopez.Specification.MongoDB | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 285 | MongoDB driver integration for EricksonLopez.Specification. Compiles ISpecification and QuerySpec descriptors into native MongoDB FilterDefinition and SortDefinition. |
| EricksonLopez.Specification.PostgreSql | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 283 | PostgreSQL dialect for EricksonLopez.Specification. Translates QueryModel to PostgreSQL-compatible SQL (LIMIT/OFFSET, ILIKE, $n parameters, etc.). |
| EricksonLopez.Specification.MySql | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 280 | MySQL and MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MySQL-compatible SQL (LIMIT/OFFSET, backtick quoting, @parameters, IN expansion). |
| EricksonLopez.Specification.MsSql | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 279 | Microsoft SQL Server (T-SQL) dialect for EricksonLopez.Specification. Translates QueryModel to SQL Server-compatible SQL (OFFSET/FETCH, TOP N, bracket quoting, @parameters, IN expansion). |
| EricksonLopez.Specification.Sqlite | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 279 | SQLite dialect for EricksonLopez.Specification. Translates QueryModel to SQLite-compatible SQL (LIMIT/OFFSET, IN expansion). Primarily used for integration testing without an external server. |
| EricksonLopez.Specification.Oracle | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 278 | Oracle Database dialect for EricksonLopez.Specification. Translates QueryModel to Oracle-compatible SQL (OFFSET/FETCH, double quote quoting, :parameters, IN expansion). |
| EricksonLopez.Specification.Result | Published | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Full | 147 | Package Description |
| EricksonLopez.Specification.AnalyzersAnalyzer / Generator | Published | v2.0.0 / v3.0.0 | netstandard2.0 | AOT: N/A (Analyzer/Legacy) | 288 | Roslyn analyzers for EricksonLopez.Specification. Detects specification anti-patterns at compile time: unbounded queries, mutable state, unsafe closures, and AOT-incompatible constructs. |
| EricksonLopez.Specification.GeneratorsAnalyzer / Generator | Published | v2.0.0 / v3.0.0 | netstandard2.0 | AOT: N/A (Analyzer/Legacy) | 275 | Roslyn source generators for EricksonLopez.Specification. Provides [Spec] attribute for strongly-typed ordering and AOT-safe expression metadata. |
8. Quick Start Code Example#
Grounded in verified public APIs from EricksonLopez.Specification. Compile with `<ImplicitUsings>disable</ImplicitUsings>` and explicit imports.
using System;
using System.Linq.Expressions;
using EricksonLopez.Specification;
public sealed record Customer(bool IsActive, decimal TotalPurchases, DateTimeOffset? DeletedAt);
public sealed class ActivePremiumCustomerSpec : Specification<Customer>
{
private readonly decimal _minimumPurchases;
public ActivePremiumCustomerSpec(decimal minimumPurchases = 1_000m)
=> _minimumPurchases = minimumPurchases;
protected override Expression<Func<Customer, bool>> BuildExpression()
=> c => c.IsActive && c.TotalPurchases >= _minimumPurchases && c.DeletedAt == null;
}9. Architecture & Dependency Flow#
Rendering diagram…
flowchart LR lib_specification["EricksonLopez.Specification (L1)"] lib_result["EricksonLopez.Result (L0)"] lib_specification -.-> lib_result
View accessible text summary and structure
1 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.
| Direction | Library | Tier | Relationship Kinds |
|---|---|---|---|
| Upstream | EricksonLopez.Result | L0 | Adapter, NuGet Package |
flowchart LR
lib_specification["EricksonLopez.Specification (L1)"]
lib_result["EricksonLopez.Result (L0)"]
lib_specification -.-> lib_result10. Target Frameworks & Native AOT / Trimming Matrix#
MSBuild `.csproj` inspection across 17 packages: 13 Full, 0 Partial, 2 Incompatible, 2 NotApplicable (analyzers/generators).
| Package ID | IsAotCompatible | EnableTrimAnalyzer | Verified AOT Status | Target Frameworks |
|---|---|---|---|---|
| EricksonLopez.Specification | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Abstractions | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Sql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Linq | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Dapper | false | true | Incompatible | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.DapperExtensions | false | true | Incompatible | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.MariaDb | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.EntityFrameworkCore | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.MongoDB | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.PostgreSql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.MySql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.MsSql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Sqlite | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Oracle | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Result | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Specification.Analyzers | false | false | NotApplicable | netstandard2.0 |
| EricksonLopez.Specification.Generators | false | false | NotApplicable | netstandard2.0 |
11. Upstream Dependencies & Downstream Dependents#
Upstream Dependencies (1)
Downstream Dependents (0)
No other EricksonLopez.* libraries currently depend on this family.
12. Optional Adapters & Third-Party Integrations#
Internal Adapter Edges & Integration Packages
- EricksonLopez.Specification.Result→ EricksonLopez.Result (EricksonLopez.Result)
Verified External NuGet Dependencies (5)
13. Configuration & DI Registration Summary#
Verified DI & Configuration Entry Points
SpecificationDbContextOptionsExtensions.UseSpecificationConfigures the `DbContext` to use EricksonLopez.Specification relational services, enabling SQL translation for `Spec.FullText` and `FullTextExtensions.MatchesFullText`.
SpecificationDbContextOptionsExtensions.UseSpecification<TContext>Configures the `DbContext` to use EricksonLopez.Specification relational services, enabling SQL translation for `Spec.FullText` and `FullTextExtensions.MatchesFullText`.
SpecificationEntityFrameworkServiceCollectionExtensions.AddEfReadRepository<TDbContext, TEntity>Registers strongly-typed `IReadRepository<TEntity>` backed by `EfReadRepository<TDbContext, TEntity>`.
SpecificationEntityFrameworkServiceCollectionExtensions.AddSpecificationEntityFrameworkRegisters generic `IReadRepository<T>` mapped to `EfReadRepository<T>`.
SpecificationEntityFrameworkServiceCollectionExtensions.AddSpecificationEntityFramework<TDbContext>Registers generic `IReadRepository<T>` mapped to `EfReadRepository<T>`.
Key Public Types & Contracts
EricksonLopez.DapperExtensions.UnitOfWork.IUnitOfWork (interface)Defines the contract for an active unit of work that manages database transactions.
EricksonLopez.Specification.CursorClause`1 (class)Represents a keyset cursor clause for pagination.
EricksonLopez.Specification.CursorDirection (enum)Specifies the seek direction for cursor-based (keyset) pagination.
EricksonLopez.Specification.ExpressionCompilationCache (class)Provides a thread-safe bounded LRU (Least Recently Used) cache for compiled expression delegates, keyed by expression structural AST equality.
EricksonLopez.Specification.ExpressionComposer (class)Provides efficient, provider-safe expression composition without `Expression.Invoke`. All compositions inline the right-hand expression body using parameter rebinding.
EricksonLopez.Specification.ExpressionDebugFormatterRegistry (class)Provides a registry for expression debug formatting across architectural layers.
EricksonLopez.Specification.ExpressionInterpreter (class)Provides an AOT-safe interpreted evaluator for domain predicate expressions.
EricksonLopez.Specification.FullTextExtensions (class)Provides extension methods for full-text search expressions.
EricksonLopez.Specification.IExpressionSpecification`1 (interface)Defines a specification that can be converted to an expression tree for query providers.
EricksonLopez.Specification.IOrderClause`1 (interface)Defines an ordering clause for entity queries.
EricksonLopez.Specification.IReadRepository`1 (interface)Defines a read-only repository contract that operates on `QuerySpec<T>` descriptors. Implementations translate specifications to provider-specific queries.
EricksonLopez.Specification.ISpecification`1 (interface)Defines a domain-level specification used to evaluate whether a candidate satisfies business criteria.
14. Verified Performance Benchmarks#
All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).
| Suite | Method | Runtime | Mean (ns) | Allocated (B) | Status |
|---|---|---|---|---|---|
| SpecificationEvaluationBenchmarks | Manual delegate | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 0.589 | 0 | measured |
| SpecificationEvaluationBenchmarks | EricksonLopez: IsSatisfiedBy (interpreted) | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 97.796 | 96 | measured |
| SpecificationEvaluationBenchmarks | EricksonLopez: IsSatisfiedBy via compiled cache | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 149.808 | 48 | measured |
| ExpressionCompositionBenchmarks | EricksonLopez: ExpressionComposer.And | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 252.7 | 448 | measured |
| SqlTranslationBenchmarks | EricksonLopez: Simple spec → SQL | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 406.1 | 1,260 | measured |
| ExpressionCompositionBenchmarks | Manual: x => left && right | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 455 | 560 | measured |
| SpecificationCreationBenchmarks | Manual lambda | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 590.3 | 800 | measured |
| ExpressionCompositionBenchmarks | EricksonLopez: 5-way AND | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 923 | 1,736 | measured |
| SpanCompositionBenchmarks | AndAll(ReadOnlySpan) x5 | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 1,178 | 1,987 | measured |
| SpanCompositionBenchmarks | Chained .And() x4 | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 1,308 | 1,987 | measured |
| SpecificationCreationBenchmarks | EricksonLopez: Spec.For factory | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 1,413.2 | 2,168 | measured |
| SpecificationCreationBenchmarks | EricksonLopez: Specification.ToExpression | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 1,428.3 | 2,152 | measured |
| SqlTranslationBenchmarks | EricksonLopez: Complex spec → SQL | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 2,402.6 | 4,188 | measured |
| SpanCompositionBenchmarks | Chained Spec.And() x4 | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 4,270 | 5,540 | measured |
| QuerySpecLinqBenchmarks | Manual LINQ | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 1,062,000 | 69,519 | measured |
| QuerySpecLinqBenchmarks | EricksonLopez: QuerySpec.Apply | .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI | 1,067,000 | 68,598 | measured |
15. Release History & NuGet vs Repo Status#
Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.0.0.
| Version | Source | Published Date | Summary |
|---|---|---|---|
| v2.0.0 ↗ | nuget | 2026-09-22 | Published EricksonLopez.Specification 2.0.0 to NuGet.org. |
| v2.0.0 ↗ | github | 2026-09-22 | [2.0.0](https://github.com/ericksonlopezf/dotnet-specification/compare/v1.0.0...v2.0.0) (2026-09-22) ⚠ BREAKING CHANGES * segregate core abstractions, harden expression engine, and enforce AST safety ✨ Features * segregate core abstractions, harden expression engine, and enforce AST safety ([7d69ede](https://github.com/ericksonlopezf/dotnet-specification/commit/7d69ede5691d8b18c7fac3fb04e582c68... |
| v1.0.0 ↗ | github | 2026-08-28 | Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.Specification.Abstractions` | `1.0.0` | | `EricksonLopez.Specification` | `1.0.0` | | `EricksonLopez.Specification.Analyzers` | `1.0.0` | | `EricksonLopez.Specification.Dapper` | `1.0.0` | | `EricksonLopez.Specification.DapperExtensions` | `1.0.0` | | `EricksonLopez.Specification.EntityFrameworkCore`... |
| v1.0.0 ↗ | nuget | 2026-08-28 | Published EricksonLopez.Specification 1.0.0 to NuGet.org. |
16. Complementary & Related Libraries#
Libraries in the same tier, architectural layer, or directly paired via dependency edges.
17. Documentation, API Reference & Portal Links#
Conceptual Documentation (Starlight) →
Extracted XML API Reference →
22 namespaces · 82 types · 365 members
Ecosystem Dependency Map →
Learning Center & Handbook →
Per-library conceptual Starlight pages expand in M4; API Reference pages expand in M3.2.
18. Source Repository, License & Contributing#
Released under the MIT License. All assemblies follow EricksonLopez.* build invariants: explicit imports, strong-name signing (`EricksonLopez.snk`), and ASCII author metadata (`Erickson Lopez`).
19. Troubleshooting, Pitfalls & Migration Guidance#
- Keep Specification<T> subclasses sealed and stateless to satisfy SPEC001 analyzer checks and predictable query plan caching.
- Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.0.0.
20. Quality & Verification Evidence#
- Strong-Name Signing (`EricksonLopez.snk`)
- EricksonLopez.snk
- `ImplicitUsings=disable`
- disable
- XML Documentation Extraction
- Verified (22 namespaces, 82 types, 365 members)
- MSBuild AOT / Trim Attributes
- 13 Full / 0 Partial / 2 Incompatible / 2 N/A
- BenchmarkDotNet Artifacts
- 16 total (16 measured, 0 na_error)
Explicit Verification Boundaries & Limitations
- All verified measurements below come strictly from `BenchmarkDotNet.Artifacts` running on .NET RyuJIT (0 NativeAOT benchmark runs exist in this snapshot).