EricksonLopez.Specification
dotnet-specification · Consultas y Datos
En esta página (20 secciones)
1. Identidad, Nivel y Perfil de Madurez#
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<PackageReference Include="EricksonLopez.Specification" Version="2.0.0" /><PackageVersion Include="EricksonLopez.Specification" Version="2.0.0" />4. Métricas Verificadas del Ecosistema#
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 Paquete | Estado | NuGet / Local | TFMs | Estado AOT | Descargas | Descripción |
|---|---|---|---|---|---|---|
| EricksonLopez.SpecificationPrincipal | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 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 | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 636 | Pure domain-level specification abstractions. Zero infrastructure dependencies. AOT-safe interfaces for ISpecification<T>, IExpressionSpecification<T>, and QuerySpec<T>. |
| EricksonLopez.Specification.Sql | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 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 | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 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 | Publicado | 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 | Publicado | 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 | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 288 | MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MariaDB-compatible SQL (backtick quoting, @parameters, LIMIT/OFFSET, expanded IN). |
| EricksonLopez.Specification.EntityFrameworkCore | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 285 | Entity Framework Core integration for EricksonLopez.Specification. Provides specification evaluation and asynchronous read repository implementations for EF Core. |
| EricksonLopez.Specification.MongoDB | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 285 | MongoDB driver integration for EricksonLopez.Specification. Compiles ISpecification and QuerySpec descriptors into native MongoDB FilterDefinition and SortDefinition. |
| EricksonLopez.Specification.PostgreSql | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 283 | PostgreSQL dialect for EricksonLopez.Specification. Translates QueryModel to PostgreSQL-compatible SQL (LIMIT/OFFSET, ILIKE, $n parameters, etc.). |
| EricksonLopez.Specification.MySql | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 280 | MySQL and MariaDB dialect for EricksonLopez.Specification. Translates QueryModel to MySQL-compatible SQL (LIMIT/OFFSET, backtick quoting, @parameters, IN expansion). |
| EricksonLopez.Specification.MsSql | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 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 | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 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 | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 278 | Oracle Database dialect for EricksonLopez.Specification. Translates QueryModel to Oracle-compatible SQL (OFFSET/FETCH, double quote quoting, :parameters, IN expansion). |
| EricksonLopez.Specification.Result | Publicado | v2.0.0 / v3.0.0 | net8.0, net9.0, net10.0 | AOT: Completo | 147 | Package Description |
| EricksonLopez.Specification.AnalyzersAnalizador / Generador | Publicado | v2.0.0 / v3.0.0 | netstandard2.0 | AOT: N/A (Analizador/Legado) | 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.GeneratorsAnalizador / Generador | Publicado | v2.0.0 / v3.0.0 | netstandard2.0 | AOT: N/A (Analizador/Legado) | 275 | Roslyn 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#
Renderizando diagrama…
flowchart LR lib_specification["EricksonLopez.Specification (L1)"] lib_result["EricksonLopez.Result (L0)"] lib_specification -.-> lib_result
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ón | Librería | Nivel | Tipos de Relación |
|---|---|---|---|
| Aguas arriba | EricksonLopez.Result | L0 | Adaptador, Paquete NuGet |
flowchart LR
lib_specification["EricksonLopez.Specification (L1)"]
lib_result["EricksonLopez.Result (L0)"]
lib_specification -.-> lib_result10. 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 Paquete | IsAotCompatible | EnableTrimAnalyzer | Estado AOT Verificado | 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. 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
- EricksonLopez.Specification.Result→ EricksonLopez.Result (EricksonLopez.Result)
Dependencias NuGet Externas Verificadas (5)
13. Resumen de Configuración y Registro en DI#
Puntos de Entrada DI y Configuración Verificados
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>`.
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).
| Suite | Método | Runtime | Media (ns) | Asignado (B) | Estado |
|---|---|---|---|---|---|
| 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. 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ón | Origen | Fecha de Publicación | Resumen |
|---|---|---|---|
| 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. Librerías Complementarias y Relacionadas#
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#
Documentación Conceptual (Starlight) →
Referencia de API XML Extraída →
22 namespaces · 82 tipos · 365 miembros
Mapa de Dependencias del Ecosistema →
Centro de Aprendizaje y Manual →
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).