EricksonLopez.Specification

dotnet-specification · Querying & Data

On this page (20 sections)

1. Identity, Tier & Maturity Profile#

L1 Domain & Query ModelingStableMaintenance: ActiveAOT: PartialMIT LicenseConfidence: HIGH
DomainApplicationnet8.0net9.0net10.0

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
Also published in this family:
EricksonLopez.Specification.AbstractionsEricksonLopez.Specification.SqlEricksonLopez.Specification.LinqEricksonLopez.Specification.DapperEricksonLopez.Specification.DapperExtensionsEricksonLopez.Specification.MariaDb

4. Verified Ecosystem Metrics#

v2.0.0
NuGet Published Version
v3.0.0
Repo HEAD Version
5,552
NuGet Downloads
17
Packable Packages
365
Public API Members
16
Benchmark Rows (RyuJIT)

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 IDStatusNuGet / LocalTFMsAOT StatusDownloadsDescription
EricksonLopez.SpecificationPrimaryPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full542Core Specification Pattern implementation for .NET 10+. AOT-first, allocation-conscious, DDD-compatible. Includes expression engine, composition, simplification, and structural hashing.
EricksonLopez.Specification.AbstractionsPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full636Pure domain-level specification abstractions. Zero infrastructure dependencies. AOT-safe interfaces for ISpecification<T>, IExpressionSpecification<T>, and QuerySpec<T>.
EricksonLopez.Specification.SqlPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full476SQL 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.LinqPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full336LINQ/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.DapperPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Incompatible304Dapper integration for EricksonLopez.Specification. Execute QuerySpec<T> against IDbConnection using parameterized SQL generated by the SQL translation layer.
EricksonLopez.Specification.DapperExtensionsPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Incompatible291DapperExtensions integration for EricksonLopez.Specification. Enables executing domain specifications over IDbConnection and IUnitOfWork.
EricksonLopez.Specification.MariaDbPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full288MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MariaDB-compatible SQL (backtick quoting, @parameters, LIMIT/OFFSET, expanded IN).
EricksonLopez.Specification.EntityFrameworkCorePublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full285Entity Framework Core integration for EricksonLopez.Specification. Provides specification evaluation and asynchronous read repository implementations for EF Core.
EricksonLopez.Specification.MongoDBPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full285MongoDB driver integration for EricksonLopez.Specification. Compiles ISpecification and QuerySpec descriptors into native MongoDB FilterDefinition and SortDefinition.
EricksonLopez.Specification.PostgreSqlPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full283PostgreSQL dialect for EricksonLopez.Specification. Translates QueryModel to PostgreSQL-compatible SQL (LIMIT/OFFSET, ILIKE, $n parameters, etc.).
EricksonLopez.Specification.MySqlPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full280MySQL and MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MySQL-compatible SQL (LIMIT/OFFSET, backtick quoting, @parameters, IN expansion).
EricksonLopez.Specification.MsSqlPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full279Microsoft 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.SqlitePublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full279SQLite 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.OraclePublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full278Oracle Database dialect for EricksonLopez.Specification. Translates QueryModel to Oracle-compatible SQL (OFFSET/FETCH, double quote quoting, :parameters, IN expansion).
EricksonLopez.Specification.ResultPublishedv2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Full147Package Description
EricksonLopez.Specification.AnalyzersAnalyzer / GeneratorPublishedv2.0.0 / v3.0.0netstandard2.0AOT: N/A (Analyzer/Legacy)288Roslyn analyzers for EricksonLopez.Specification. Detects specification anti-patterns at compile time: unbounded queries, mutable state, unsafe closures, and AOT-incompatible constructs.
EricksonLopez.Specification.GeneratorsAnalyzer / GeneratorPublishedv2.0.0 / v3.0.0netstandard2.0AOT: N/A (Analyzer/Legacy)275Roslyn 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#

flowchart LR
  lib_specification["EricksonLopez.Specification (L1)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_specification -.-> lib_result
EricksonLopez.Specification Dependency Topology1 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.
View accessible text summary and structure

1 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.

DirectionLibraryTierRelationship Kinds
UpstreamEricksonLopez.ResultL0Adapter, NuGet Package
flowchart LR
  lib_specification["EricksonLopez.Specification (L1)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_specification -.-> lib_result

10. Target Frameworks & Native AOT / Trimming Matrix#

MSBuild `.csproj` inspection across 17 packages: 13 Full, 0 Partial, 2 Incompatible, 2 NotApplicable (analyzers/generators).

Package IDIsAotCompatibleEnableTrimAnalyzerVerified AOT StatusTarget Frameworks
EricksonLopez.SpecificationtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.AbstractionstruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.SqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.LinqtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.DapperfalsetrueIncompatiblenet8.0, net9.0, net10.0
EricksonLopez.Specification.DapperExtensionsfalsetrueIncompatiblenet8.0, net9.0, net10.0
EricksonLopez.Specification.MariaDbtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.EntityFrameworkCoretruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.MongoDBtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.PostgreSqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.MySqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.MsSqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.SqlitetruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.OracletruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.ResulttruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Specification.AnalyzersfalsefalseNotApplicablenetstandard2.0
EricksonLopez.Specification.GeneratorsfalsefalseNotApplicablenetstandard2.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

Verified External NuGet Dependencies (5)

DapperMicrosoft.EntityFrameworkCoreMicrosoft.EntityFrameworkCore.RelationalMicrosoft.Extensions.DependencyInjection.AbstractionsMongoDB.Driver

13. Configuration & DI Registration Summary#

Verified DI & Configuration Entry Points

  • SpecificationDbContextOptionsExtensions.UseSpecification

    Configures 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.AddSpecificationEntityFramework

    Registers 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).

Total rows: 16 · Measured: 16 · NA / Error: 0 · Suites: 6

Observed runtimes: .NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI

Observed CPUs: Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 4 logical and 2 physical cores

SuiteMethodRuntimeMean (ns)Allocated (B)Status
SpecificationEvaluationBenchmarksManual delegate.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI0.5890measured
SpecificationEvaluationBenchmarksEricksonLopez: IsSatisfiedBy (interpreted).NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI97.79696measured
SpecificationEvaluationBenchmarksEricksonLopez: IsSatisfiedBy via compiled cache.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI149.80848measured
ExpressionCompositionBenchmarksEricksonLopez: ExpressionComposer.And.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI252.7448measured
SqlTranslationBenchmarksEricksonLopez: Simple spec → SQL.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI406.11,260measured
ExpressionCompositionBenchmarksManual: x => left && right.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI455560measured
SpecificationCreationBenchmarksManual lambda.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI590.3800measured
ExpressionCompositionBenchmarksEricksonLopez: 5-way AND.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI9231,736measured
SpanCompositionBenchmarksAndAll(ReadOnlySpan) x5.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,1781,987measured
SpanCompositionBenchmarksChained .And() x4.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,3081,987measured
SpecificationCreationBenchmarksEricksonLopez: Spec.For factory.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,413.22,168measured
SpecificationCreationBenchmarksEricksonLopez: Specification.ToExpression.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,428.32,152measured
SqlTranslationBenchmarksEricksonLopez: Complex spec → SQL.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI2,402.64,188measured
SpanCompositionBenchmarksChained Spec.And() x4.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI4,2705,540measured
QuerySpecLinqBenchmarksManual LINQ.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,062,00069,519measured
QuerySpecLinqBenchmarksEricksonLopez: QuerySpec.Apply.NET 10.0.12 X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI1,067,00068,598measured

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.

VersionSourcePublished DateSummary
v2.0.0 ↗nuget2026-09-22Published EricksonLopez.Specification 2.0.0 to NuGet.org.
v2.0.0 ↗github2026-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 ↗github2026-08-28Ecosystem 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 ↗nuget2026-08-28Published EricksonLopez.Specification 1.0.0 to NuGet.org.

Libraries in the same tier, architectural layer, or directly paired via dependency edges.

17. Documentation, API Reference & Portal Links#

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).

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.