EricksonLopez.Specification

dotnet-specification · Consultas y Datos

En esta página (20 secciones)

1. Identidad, Nivel y Perfil de Madurez#

L1 Modelado de Dominio y ConsultasEstableMantenimiento: ActivoAOT: ParcialLicencia MITConfianza: HIGH
DomainApplicationnet8.0net9.0net10.0

2. Propuesta de Valor y Problema que Resuelve#

A high-performance, AOT-first, zero-reflection, zero-allocation specification pattern implementation for modern .NET, powered by Roslyn Incremental Source Generators

Las librerías tradicionales de especificaciones usan Expression.Compile() en ejecución, rompiendo Native AOT, o filtran conceptos de ORM en la capa Domain.

3. Instalación Rápida#

Paquete principal: EricksonLopez.Specification

dotnet add package EricksonLopez.Specification --version 2.0.0
También publicado en esta familia:
EricksonLopez.Specification.AbstractionsEricksonLopez.Specification.SqlEricksonLopez.Specification.LinqEricksonLopez.Specification.DapperEricksonLopez.Specification.DapperExtensionsEricksonLopez.Specification.MariaDb

4. Métricas Verificadas del Ecosistema#

v2.0.0
Versión Publicada en NuGet
v3.0.0
Versión HEAD del Repo
5,552
Descargas en NuGet
17
Paquetes Empaquetables
365
Miembros Públicos de API
16
Filas Benchmark (RyuJIT)

Instantánea recuperada UTC: 2026-12-01

5. Cuándo Usar y Cuándo NO Usar#

Cuándo usar

  • Quieres predicados puros Specification<T> en Domain combinados con traducción SQL multi-dialecto o adaptadores EF Core/MongoDB.

Cuándo NO usar

  • Solo ejecutas consultas SQL estáticas sin composición de predicados reutilizables; usa EricksonLopez.SqlBuilder directamente.

6. Capacidades Principales e Invariantes de Diseño#

Evaluación Segura para Trimming

Soporta evaluación interpretada, caché acotada QueryPlanCache y composición con spans mediante AndAll/OrAny.

SQL Multi-Dialecto y Keyset

Traduce QuerySpec<T> para PostgreSQL, SQL Server, MySQL, MariaDB, SQLite y Oracle con soporte SeekAfter/SeekBefore.

7. Paquetes NuGet y Adaptadores Incluidos#

ID del PaqueteEstadoNuGet / LocalTFMsEstado AOTDescargasDescripción
EricksonLopez.SpecificationPrincipalPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo542Core Specification Pattern implementation for .NET 10+. AOT-first, allocation-conscious, DDD-compatible. Includes expression engine, composition, simplification, and structural hashing.
EricksonLopez.Specification.AbstractionsPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo636Pure domain-level specification abstractions. Zero infrastructure dependencies. AOT-safe interfaces for ISpecification<T>, IExpressionSpecification<T>, and QuerySpec<T>.
EricksonLopez.Specification.SqlPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo476SQL 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.LinqPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo336LINQ/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.DapperPublicadov2.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.DapperExtensionsPublicadov2.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.MariaDbPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo288MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MariaDB-compatible SQL (backtick quoting, @parameters, LIMIT/OFFSET, expanded IN).
EricksonLopez.Specification.EntityFrameworkCorePublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo285Entity Framework Core integration for EricksonLopez.Specification. Provides specification evaluation and asynchronous read repository implementations for EF Core.
EricksonLopez.Specification.MongoDBPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo285MongoDB driver integration for EricksonLopez.Specification. Compiles ISpecification and QuerySpec descriptors into native MongoDB FilterDefinition and SortDefinition.
EricksonLopez.Specification.PostgreSqlPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo283PostgreSQL dialect for EricksonLopez.Specification. Translates QueryModel to PostgreSQL-compatible SQL (LIMIT/OFFSET, ILIKE, $n parameters, etc.).
EricksonLopez.Specification.MySqlPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo280MySQL and MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MySQL-compatible SQL (LIMIT/OFFSET, backtick quoting, @parameters, IN expansion).
EricksonLopez.Specification.MsSqlPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo279Microsoft 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.SqlitePublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo279SQLite 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.OraclePublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo278Oracle Database dialect for EricksonLopez.Specification. Translates QueryModel to Oracle-compatible SQL (OFFSET/FETCH, double quote quoting, :parameters, IN expansion).
EricksonLopez.Specification.ResultPublicadov2.0.0 / v3.0.0net8.0, net9.0, net10.0AOT: Completo147Package Description
EricksonLopez.Specification.AnalyzersAnalizador / GeneradorPublicadov2.0.0 / v3.0.0netstandard2.0AOT: N/A (Analizador/Legado)288Roslyn analyzers for EricksonLopez.Specification. Detects specification anti-patterns at compile time: unbounded queries, mutable state, unsafe closures, and AOT-incompatible constructs.
EricksonLopez.Specification.GeneratorsAnalizador / GeneradorPublicadov2.0.0 / v3.0.0netstandard2.0AOT: N/A (Analizador/Legado)275Roslyn source generators for EricksonLopez.Specification. Provides [Spec] attribute for strongly-typed ordering and AOT-safe expression metadata.

8. Ejemplo Quick Start#

Basado en APIs públicas verificadas de EricksonLopez.Specification. Compila con `<ImplicitUsings>disable</ImplicitUsings>` e importaciones explícitas.

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. Arquitectura y Flujo de Dependencias#

flowchart LR
  lib_specification["EricksonLopez.Specification (L1)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_specification -.-> lib_result
Topología de Dependencias de EricksonLopez.Specification1 dependencias hacia librerías aguas arriba y 0 librerías dependientes aguas abajo verificadas en dependencies.json.
Ver descripción textual y tabla accesible

1 dependencias hacia librerías aguas arriba y 0 librerías dependientes aguas abajo verificadas en dependencies.json.

DirecciónLibreríaNivelTipos de Relación
Aguas arribaEricksonLopez.ResultL0Adaptador, Paquete NuGet
flowchart LR
  lib_specification["EricksonLopez.Specification (L1)"]
  lib_result["EricksonLopez.Result (L0)"]
  lib_specification -.-> lib_result

10. Target Frameworks y Matriz Native AOT / Trimming#

Inspección MSBuild `.csproj` sobre 17 paquetes: 13 Full, 0 Partial, 2 Incompatible, 2 NotApplicable (analizadores/generadores).

ID del PaqueteIsAotCompatibleEnableTrimAnalyzerEstado AOT VerificadoTarget 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. Dependencias Aguas Arriba y Dependientes Aguas Abajo#

Dependencias Aguas Arriba (1)

Dependientes Aguas Abajo (0)

Ninguna otra librería EricksonLopez.* depende actualmente de esta familia.

12. Adaptadores Opcionales e Integraciones Externas#

Aristas de Adaptadores Internos y Paquetes de Integración

Dependencias NuGet Externas Verificadas (5)

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

13. Resumen de Configuración y Registro en DI#

Puntos de Entrada DI y Configuración Verificados

  • 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>`.

Tipos Públicos y Contratos Clave

  • 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. Benchmarks de Rendimiento Verificados#

Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).

Filas totales: 16 · Medidos: 16 · NA / Error: 0 · Suites: 6

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

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

SuiteMétodoRuntimeMedia (ns)Asignado (B)Estado
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. Historial de Versiones y Estado NuGet vs Repositorio#

Desfase de versiones detectado: la última versión publicada en NuGet.org es v2.0.0, mientras el HEAD del repositorio local está en v3.0.0.

VersiónOrigenFecha de PublicaciónResumen
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.

Librerías en el mismo nivel, capa arquitectónica o vinculadas directamente mediante aristas de dependencia.

17. Documentación, API Reference y Enlaces del Portal#

Las páginas conceptuales por librería en Starlight se completan en M4; las páginas de API Reference en M3.2.

18. Repositorio Fuente, Licencia y Contribución#

Publicado bajo Licencia MIT. Todos los ensamblados cumplen los invariantes de compilación EricksonLopez.*: importaciones explícitas, firma fuerte (`EricksonLopez.snk`) y metadatos de autor en ASCII (`Erickson Lopez`).

19. Resolución de Problemas, Riesgos y Migración#

  • Mantén tus subclases Specification<T> como sealed y sin estado mutable para cumplir la regla SPEC001 y cachear planes.
  • Desfase de versiones detectado: la última versión publicada en NuGet.org es v2.0.0, mientras el HEAD del repositorio local está en v3.0.0.

20. Evidencia de Calidad y Verificación#

Firma Fuerte (`EricksonLopez.snk`)
EricksonLopez.snk
`ImplicitUsings=disable`
disable
Extracción de Documentación XML
Verificado (22 namespaces, 82 tipos, 365 miembros)
Atributos MSBuild AOT / Trimming
13 Full / 0 Partial / 2 Incompatible / 2 N/A
Artefactos BenchmarkDotNet
16 total (16 measured, 0 na_error)

Límites Explícitos de Verificación y Alcance

  • Todas las mediciones verificadas provienen estrictamente de `BenchmarkDotNet.Artifacts` ejecutados sobre .NET RyuJIT (existen 0 ejecuciones NativeAOT en esta instantánea).

Buscar en el Ecosistema EricksonLopez.*

Escribe el nombre de una librería, ID de paquete NuGet, tipo .NET o concepto arquitectónico para buscar en el portal.