EricksonLopez.Concurrency
dotnet-concurrency · Reliability & Concurrency
On this page (20 sections)
1. Identity, Tier & Maturity Profile#
2. Value Proposition & Problem Solved#
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.
Concurrent read-modify-write workflows cause silent lost updates and TOCTOU race windows when preceding SELECT checks are decoupled from conditional UPDATE statements.
3. Quick Install#
Primary package: 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. Verified Ecosystem Metrics#
Snapshot retrieved UTC: 2026-12-01
5. When to Use & When Not to Use#
When to use
- You want deterministic Optimistic Concurrency Control (OCC) with CAS version tokens, conflict resolvers, and 6 relational dialects.
When NOT to use
- You need pessimistic mutual exclusion across distributed workers—use EricksonLopez.DistributedLock.
6. Core Capabilities & Design Invariants#
Zero-Allocation CAS & Version Tokens
Stack-level ConcurrencyToken and overflow-checked version transitions returning structured CasResult<T>.
6-Dialect Conditional Updates
Adapters for PostgreSQL (xmin), SQL Server (ROWVERSION), MySQL, MariaDB, Oracle, SQLite, plus ASP.NET Core and Mediator.
7. Included NuGet Packages & Adapters#
| Package ID | Status | NuGet / Local | TFMs | AOT Status | Downloads | Description |
|---|---|---|---|---|---|---|
| EricksonLopez.ConcurrencyPrimary | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 393 | Core concurrency orchestration, optimistic verification, conflict resolvers, diagnostics, and OpenTelemetry instrumentation for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.Abstractions | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 634 | Core abstractions, concurrency tokens, versioning contracts, and conflict domain models for the EricksonLopez.Concurrency framework. |
| EricksonLopez.Concurrency.Dapper | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 337 | High-performance Dapper optimistic concurrency extensions and SQL versioning adapters for the EricksonLopez.Concurrency framework. |
| EricksonLopez.Concurrency.Mediator | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 298 | EricksonLopez.Mediator pipeline integration and high-performance concurrency behaviors for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.PostgreSql | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 296 | PostgreSQL-specific concurrency error classifier, xmin concurrency tokens, and row-level locking utilities for the EricksonLopez.Concurrency framework. |
| EricksonLopez.Concurrency.MySql | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 284 | MySQL concurrency dialect, error classification, and row locking extensions for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.MariaDb | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 283 | MariaDB concurrency dialect, error classification, and lock timeout extensions for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.SqlServer | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 280 | Microsoft SQL Server concurrency dialect, error classification, rowversion tokens, and table hints for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.Sqlite | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 279 | SQLite concurrency dialect and busy/locked error classification for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.AspNetCore | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 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 | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 274 | Testing utilities, mock-free test doubles (FakeConcurrencyController), and fluent builders for EricksonLopez.Concurrency. |
| EricksonLopez.Concurrency.Oracle | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 269 | Oracle concurrency dialect, error classification, ORA_ROWSCN tokens, and locking extensions for the EricksonLopez.Concurrency ecosystem. |
| EricksonLopez.Concurrency.Result | Published | v2.0.0 / v3.1.0 | net8.0, net9.0, net10.0 | AOT: Full | 263 | Functional monadic integration bridge between EricksonLopez.Concurrency and EricksonLopez.Result. |
8. Quick Start Code Example#
Grounded in verified public APIs from EricksonLopez.Concurrency. Compile with `<ImplicitUsings>disable</ImplicitUsings>` and explicit imports.
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. Architecture & Dependency Flow#
Rendering diagram…
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
View accessible text summary and structure
2 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.
| Direction | Library | Tier | Relationship Kinds |
|---|---|---|---|
| Upstream | EricksonLopez.Result | L0 | Adapter, NuGet Package |
| Upstream | EricksonLopez.Mediator | L2 | Adapter, NuGet Package |
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 & Native AOT / Trimming Matrix#
MSBuild `.csproj` inspection across 13 packages: 13 Full, 0 Partial, 0 Incompatible, 0 NotApplicable (analyzers/generators).
| Package ID | IsAotCompatible | EnableTrimAnalyzer | Verified AOT Status | 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. Upstream Dependencies & Downstream Dependents#
Upstream Dependencies (2)
Downstream Dependents (0)
No other EricksonLopez.* libraries currently depend on this family.
12. Optional Adapters & Third-Party Integrations#
Internal Adapter Edges & Integration Packages
- EricksonLopez.Concurrency.Mediator→ EricksonLopez.Mediator (EricksonLopez.Mediator)
- EricksonLopez.Concurrency.Result→ EricksonLopez.Result (EricksonLopez.Result)
Verified External NuGet Dependencies (10)
13. Configuration & DI Registration Summary#
Verified DI & Configuration Entry Points
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.
Key Public Types & Contracts
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. 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 |
|---|---|---|---|---|---|
| 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. 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.1.0.
| Version | Source | Published Date | Summary |
|---|---|---|---|
| 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. 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 →
27 namespaces · 82 types · 459 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#
- Implement IMutableVersionedEntity when using automatic CAS version advancement, or IVersionedEntity for read-only version inspection.
- Version lag detected: NuGet.org latest published version is v2.0.0, while local repository HEAD is at v3.1.0.
20. Quality & Verification Evidence#
- Strong-Name Signing (`EricksonLopez.snk`)
- EricksonLopez.snk
- `ImplicitUsings=disable`
- disable
- XML Documentation Extraction
- Verified (27 namespaces, 82 types, 459 members)
- MSBuild AOT / Trim Attributes
- 13 Full / 0 Partial / 0 Incompatible / 0 N/A
- BenchmarkDotNet Artifacts
- 54 total (18 measured, 36 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).