EricksonLopez.Concurrency
dotnet-concurrency · Fiabilidad y Concurrencia
En esta página (20 secciones)
1. Identidad, Nivel y Perfil de Madurez#
2. Propuesta de Valor y Problema que Resuelve#
Zero-allocation, Native AOT Optimistic Concurrency Control (OCC) and conflict resolution framework for .NET. Eliminates lost updates and race conditions across Dapper, ASP.NET Core, and relational databases.
Los flujos concurrentes de lectura-modificación-escritura provocan pérdidas silenciosas de actualizaciones y ventanas TOCTOU cuando el SELECT previo se separa del UPDATE condicional.
3. Instalación Rápida#
Paquete principal: EricksonLopez.Concurrency
dotnet add package EricksonLopez.Concurrency --version 2.0.0<PackageReference Include="EricksonLopez.Concurrency" Version="2.0.0" /><PackageVersion Include="EricksonLopez.Concurrency" 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 Control de Concurrencia Optimista (OCC) determinista con tokens CAS, resolvedores de conflicto y 6 dialectos relacionales.
Cuándo NO usar
- Necesitas exclusión mutua pesimista entre workers distribuidos; usa EricksonLopez.DistributedLock.
6. Capacidades Principales e Invariantes de Diseño#
CAS y Tokens de Versión Sin Asignación
ConcurrencyToken y transiciones verificadas contra desbordamiento que retornan CasResult<T> estructurado.
Actualizaciones Condicionales en 6 Dialectos
Adaptadores para PostgreSQL (xmin), SQL Server (ROWVERSION), MySQL, MariaDB, Oracle, SQLite, ASP.NET Core y Mediator.
7. Paquetes NuGet y Adaptadores Incluidos#
| ID del Paquete | Estado | NuGet / Local | TFMs | Estado AOT | Descargas | Descripción |
|---|---|---|---|---|---|---|
| EricksonLopez.ConcurrencyPrincipal | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 393 | Core concurrency orchestration, optimistic verification, conflict resolvers, diagnostics, and OpenTelemetry instrumentation for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.Abstractions | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 634 | Core abstractions, concurrency tokens, versioning contracts, and conflict domain models for the EricksonLopez.Concurrency framework. |
| EricksonLopez.Concurrency.Dapper | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 337 | High-performance Dapper optimistic concurrency extensions and SQL versioning adapters for the EricksonLopez.Concurrency framework. |
| EricksonLopez.Concurrency.Mediator | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 298 | EricksonLopez.Mediator pipeline integration and high-performance concurrency behaviors for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.PostgreSql | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 296 | PostgreSQL-specific concurrency error classifier, xmin concurrency tokens, and row-level locking utilities for the EricksonLopez.Concurrency framework. |
| EricksonLopez.Concurrency.MySql | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 284 | MySQL concurrency dialect, error classification, and row locking extensions for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.MariaDb | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 283 | MariaDB concurrency dialect, error classification, and lock timeout extensions for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.SqlServer | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 280 | Microsoft SQL Server concurrency dialect, error classification, rowversion tokens, and table hints for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.Sqlite | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 279 | SQLite concurrency dialect and busy/locked error classification for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.AspNetCore | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 277 | ASP.NET Core integration for EricksonLopez.Concurrency providing HTTP 409 Conflict middleware, RFC 7807 ProblemDetails, ETag header helpers, and minimal API extensions. |
| EricksonLopez.Concurrency.Testing | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 274 | Testing utilities, mock-free test doubles (FakeConcurrencyController), and fluent builders for EricksonLopez.Concurrency. |
| EricksonLopez.Concurrency.Oracle | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 269 | Oracle concurrency dialect, error classification, ORA_ROWSCN tokens, and locking extensions for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.Result | Publicado | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Completo | 263 | Functional monadic integration bridge between EricksonLopez.Concurrency and EricksonLopez.Result. |
8. Ejemplo Quick Start#
Basado en APIs públicas verificadas de EricksonLopez.Concurrency. Compila con `<ImplicitUsings>disable</ImplicitUsings>` e importaciones explícitas.
using EricksonLopez.Concurrency.Abstractions;
public sealed class CustomerAccount : IMutableVersionedEntity
{
public string Id { get; init; } = string.Empty;
public string OwnerName { get; set; } = string.Empty;
public decimal Balance { get; set; }
public long Version { get; set; } = 1;
}9. Arquitectura y Flujo de Dependencias#
Renderizando diagrama…
flowchart LR lib_concurrency["EricksonLopez.Concurrency (L2)"] lib_result["EricksonLopez.Result (L0)"] lib_concurrency -.-> lib_result lib_mediator["EricksonLopez.Mediator (L2)"] lib_concurrency -.-> lib_mediator
Ver descripción textual y tabla accesible
2 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 |
| Aguas arriba | EricksonLopez.Mediator | L2 | Adaptador, Paquete NuGet |
flowchart LR
lib_concurrency["EricksonLopez.Concurrency (L2)"]
lib_result["EricksonLopez.Result (L0)"]
lib_concurrency -.-> lib_result
lib_mediator["EricksonLopez.Mediator (L2)"]
lib_concurrency -.-> lib_mediator10. Target Frameworks y Matriz Native AOT / Trimming#
Inspección MSBuild `.csproj` sobre 13 paquetes: 13 Full, 0 Partial, 0 Incompatible, 0 NotApplicable (analizadores/generadores).
| ID del Paquete | IsAotCompatible | EnableTrimAnalyzer | Estado AOT Verificado | Target Frameworks |
|---|---|---|---|---|
| EricksonLopez.Concurrency | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Abstractions | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Dapper | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Mediator | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.PostgreSql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.MySql | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.MariaDb | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.SqlServer | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Sqlite | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.AspNetCore | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Testing | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Oracle | true | true | Full | net8.0, net9.0, net10.0 |
| EricksonLopez.Concurrency.Result | true | true | Full | net8.0, net9.0, net10.0 |
11. Dependencias Aguas Arriba y Dependientes Aguas Abajo#
Dependencias Aguas Arriba (2)
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.Concurrency.Mediator→ EricksonLopez.Mediator (EricksonLopez.Mediator)
- EricksonLopez.Concurrency.Result→ EricksonLopez.Result (EricksonLopez.Result)
Dependencias NuGet Externas Verificadas (10)
13. Resumen de Configuración y Registro en DI#
Puntos de Entrada DI y Configuración Verificados
ConcurrencyAspNetCoreServiceCollectionExtensions.AddConcurrencyAspNetCoreRegisters ASP.NET Core concurrency integration dependencies into the specified `IServiceCollection`.
ConcurrencyMiddlewareExtensions.UseConcurrencyConflictHandlingAdds the `ConcurrencyConflictMiddleware` to the application pipeline to automatically convert `ConcurrencyException` into RFC 7807 HTTP 409 Conflict responses.
DapperConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyDapperRegisters Dapper optimistic concurrency adapter services.
ConcurrencyServiceCollectionExtensions.AddConflictResolver<TEntity, TResolver>Registers a custom domain-specific conflict resolver for the specified entity type.
ConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyRegisters core concurrency services including the default concurrency checker, controller, and rejection resolver.
MariaDbConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyMariaDbRegisters MariaDB concurrency dialect services into the dependency injection container.
ConcurrencyMediatorServiceCollectionExtensions.AddConcurrencyMediatorBehaviorRegisters the `ConcurrencyBehavior<TRequest, TResponse>` open generic pipeline behavior in the service collection.
MySqlConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyMySqlRegisters MySQL concurrency dialect services into the dependency injection container.
OracleConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyOracleRegisters Oracle concurrency dialect services into the dependency injection container.
PostgreSqlConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyPostgreSqlRegisters PostgreSQL concurrency adapter services and diagnostic classifiers.
SqlServerConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencySqlServerRegisters Microsoft SQL Server concurrency dialect services and classifiers into the dependency injection container.
SqliteConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencySqliteRegisters SQLite concurrency dialect services into the dependency injection container.
Tipos Públicos y Contratos Clave
EricksonLopez.Concurrency.Abstractions.ActualVersion (record)Represents the actual version discovered during persistence or conflict inspection.
EricksonLopez.Concurrency.Abstractions.CasResult (class)Provides non-generic factory methods for constructing `CasResult<TEntity>` instances.
EricksonLopez.Concurrency.Abstractions.CasResult`1 (record)Represents the result of an atomic or optimistic Compare-And-Swap (CAS) state transition.
EricksonLopez.Concurrency.Abstractions.ConcurrencyConfigurationException (class)Represents an exception thrown when concurrency options, policies, or resolvers are misconfigured.
EricksonLopez.Concurrency.Abstractions.ConcurrencyConflict (record)Encapsulates rich, immutable diagnostic and domain details of a detected concurrency conflict.
EricksonLopez.Concurrency.Abstractions.ConcurrencyConflictClassification (enum)Classifies a concurrency conflict to guide higher-level resilience, retry, and operational decisions.
EricksonLopez.Concurrency.Abstractions.ConcurrencyConflictType (enum)Specifies the nature and category of a detected concurrency conflict.
EricksonLopez.Concurrency.Abstractions.ConcurrencyException (class)Represents the base exception thrown when an unhandled concurrency conflict occurs in an exceptional flow.
EricksonLopez.Concurrency.Abstractions.ConcurrencyToken (record)Represents an immutable, opaque concurrency token used to validate state consistency.
EricksonLopez.Concurrency.Abstractions.ConcurrencyTokenMismatchException (class)Represents an exception thrown when a strict concurrency token comparison fails.
EricksonLopez.Concurrency.Abstractions.ConcurrencyVersion (record)Represents an immutable, zero-allocation strongly-typed numeric concurrency version.
EricksonLopez.Concurrency.Abstractions.ConcurrencyVersion`1 (record)Represents an immutable, strongly-typed numeric concurrency version bound to a specific entity or aggregate type `TEntity`.
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 |
|---|---|---|---|---|---|
| TokenAllocationBenchmarks | CreateStructVersion | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 0 | 0 | measured |
| TokenAllocationBenchmarks | CreateExpectedVersionSpecific | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 0.001 | 0 | measured |
| ConcurrencyBenchmarks | DirectVersionComparison | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 0.135 | 0 | measured |
| TokenAllocationBenchmarks | CheckExpectedMatchesActual | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 0.375 | 0 | measured |
| ConcurrencyBenchmarks | CheckerCheckVersion | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 0.534 | 0 | measured |
| TokenAllocationBenchmarks | CreateStructToken | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 1.18 | 0 | measured |
| TokenAllocationBenchmarks | CompareTokensValueEquality | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 1.884 | 0 | measured |
| ConcurrencyBenchmarks | ResultConversion | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 3.445 | 0 | measured |
| TokenAllocationBenchmarks | FormatVersionToString | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 14.017 | 48 | measured |
| TokenAllocationBenchmarks | TryParseSpanVersion | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 14.185 | 0 | measured |
| TokenAllocationBenchmarks | TryParseStringVersion | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 16.217 | 0 | measured |
| ConcurrencyBenchmarks | CheckerCheckToken | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 22.865 | 64 | measured |
| ConflictResolutionBenchmarks | RejectFatalConflictImmediately | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 106.5 | 216 | measured |
| ConflictResolutionBenchmarks | ResolveTransientConflictWithMerge | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 115.2 | 224 | measured |
| ConcurrencyBenchmarks | ControllerExecuteCasAsync | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 182.184 | 0 | measured |
| OptimisticContentionBenchmarks | SingleWorkerUncontendedCas | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 201.6 | 48 | measured |
| OptimisticContentionBenchmarks | VersionPreconditionMismatchEvaluation | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 238.9 | 568 | measured |
| OptimisticContentionBenchmarks | ParallelContentionFourWorkers | .NET 10.0.12 X64 RyuJIT x86-64-v3 | 2,629.2 | 976 | 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.1.0.
| Versión | Origen | Fecha de Publicación | Resumen |
|---|---|---|---|
| v2.0.0 ↗ | nuget | 2026-09-24 | Published EricksonLopez.Concurrency 2.0.0 to NuGet.org. |
| v2.0.0 ↗ | github | 2026-09-24 | [2.0.0](https://github.com/ericksonlopezf/dotnet-concurrency/compare/v1.0.0...v2.0.0) (2026-09-24) ⚠ BREAKING CHANGES * Merge release/v2.0.0 ✨ Features * Merge release/v2.0.0 ([7bb1254](https://github.com/ericksonlopezf/dotnet-concurrency/commit/7bb12545049a8bdf1a8921c99c80482015840366)) |
| v1.0.0 ↗ | github | 2026-08-29 | Ecosystem Packages in this release | Package | Version | |---------|---------| | `EricksonLopez.Concurrency.Abstractions` | `1.0.0` | | `EricksonLopez.Concurrency` | `1.0.0` | | `EricksonLopez.Concurrency.AspNetCore` | `1.0.0` | | `EricksonLopez.Concurrency.Dapper` | `1.0.0` | | `EricksonLopez.Concurrency.MariaDb` | `1.0.0` | | `EricksonLopez.Concurrency.Mediator` | `1.0.0` | | `EricksonLopez.C... |
| v1.0.0 ↗ | nuget | 2026-08-29 | Published EricksonLopez.Concurrency 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 →
27 namespaces · 82 tipos · 459 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#
- Implementa IMutableVersionedEntity para avance automático de versión CAS, o IVersionedEntity para inspección de solo lectura.
- 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.1.0.
20. Evidencia de Calidad y Verificación#
- Firma Fuerte (`EricksonLopez.snk`)
- EricksonLopez.snk
- `ImplicitUsings=disable`
- disable
- Extracción de Documentación XML
- Verificado (27 namespaces, 82 tipos, 459 miembros)
- Atributos MSBuild AOT / Trimming
- 13 Full / 0 Partial / 0 Incompatible / 0 N/A
- Artefactos BenchmarkDotNet
- 54 total (18 measured, 36 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).