EricksonLopez.Concurrency

dotnet-concurrency · Reliability & Concurrency

On this page (20 sections)

1. Identity, Tier & Maturity Profile#

L2 Cross-Cutting & ReliabilityStableMaintenance: ActiveAOT: FullMIT LicenseConfidence: HIGH
ApplicationInfrastructurenet8.0net9.0net10.0

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
Also published in this family:
EricksonLopez.Concurrency.AbstractionsEricksonLopez.Concurrency.DapperEricksonLopez.Concurrency.MediatorEricksonLopez.Concurrency.PostgreSqlEricksonLopez.Concurrency.MySqlEricksonLopez.Concurrency.MariaDb

4. Verified Ecosystem Metrics#

v2.0.0
NuGet Published Version
v3.1.0
Repo HEAD Version
4,167
NuGet Downloads
13
Packable Packages
459
Public API Members
54
Benchmark Rows (RyuJIT)

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 IDStatusNuGet / LocalTFMsAOT StatusDownloadsDescription
EricksonLopez.ConcurrencyPrimaryPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full393Core concurrency orchestration, optimistic verification, conflict resolvers, diagnostics, and OpenTelemetry instrumentation for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.AbstractionsPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full634Core abstractions, concurrency tokens, versioning contracts, and conflict domain models for the EricksonLopez.Concurrency framework.
EricksonLopez.Concurrency.DapperPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full337High-performance Dapper optimistic concurrency extensions and SQL versioning adapters for the EricksonLopez.Concurrency framework.
EricksonLopez.Concurrency.MediatorPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full298EricksonLopez.Mediator pipeline integration and high-performance concurrency behaviors for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.PostgreSqlPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full296PostgreSQL-specific concurrency error classifier, xmin concurrency tokens, and row-level locking utilities for the EricksonLopez.Concurrency framework.
EricksonLopez.Concurrency.MySqlPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full284MySQL concurrency dialect, error classification, and row locking extensions for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.MariaDbPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full283MariaDB concurrency dialect, error classification, and lock timeout extensions for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.SqlServerPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full280Microsoft SQL Server concurrency dialect, error classification, rowversion tokens, and table hints for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.SqlitePublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full279SQLite concurrency dialect and busy/locked error classification for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.AspNetCorePublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full277ASP.NET Core integration for EricksonLopez.Concurrency providing HTTP 409 Conflict middleware, RFC 7807 ProblemDetails, ETag header helpers, and minimal API extensions.
EricksonLopez.Concurrency.TestingPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full274Testing utilities, mock-free test doubles (FakeConcurrencyController), and fluent builders for EricksonLopez.Concurrency.
EricksonLopez.Concurrency.OraclePublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full269Oracle concurrency dialect, error classification, ORA_ROWSCN tokens, and locking extensions for the EricksonLopez.Concurrency ecosystem.
EricksonLopez.Concurrency.ResultPublishedv2.0.0 / v3.1.0net8.0, net9.0, net10.0AOT: Full263Functional 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#

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
EricksonLopez.Concurrency Dependency Topology2 upstream library dependencies and 0 downstream dependent libraries verified in dependencies.json.
View accessible text summary and structure

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

DirectionLibraryTierRelationship Kinds
UpstreamEricksonLopez.ResultL0Adapter, NuGet Package
UpstreamEricksonLopez.MediatorL2Adapter, 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_mediator

10. Target Frameworks & Native AOT / Trimming Matrix#

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

Package IDIsAotCompatibleEnableTrimAnalyzerVerified AOT StatusTarget Frameworks
EricksonLopez.ConcurrencytruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.AbstractionstruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.DappertruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.MediatortruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.PostgreSqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.MySqltruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.MariaDbtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.SqlServertruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.SqlitetruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.AspNetCoretruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.TestingtruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.OracletruetrueFullnet8.0, net9.0, net10.0
EricksonLopez.Concurrency.ResulttruetrueFullnet8.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

Verified External NuGet Dependencies (10)

DapperMicrosoft.Data.SqlClientMicrosoft.Data.SqliteMicrosoft.Extensions.DependencyInjection.AbstractionsMicrosoft.Extensions.Logging.AbstractionsMicrosoft.Extensions.OptionsMySqlConnectorNpgsqlOpenTelemetry.ApiOracle.ManagedDataAccess.Core

13. Configuration & DI Registration Summary#

Verified DI & Configuration Entry Points

  • ConcurrencyAspNetCoreServiceCollectionExtensions.AddConcurrencyAspNetCore

    Registers ASP.NET Core concurrency integration dependencies into the specified `IServiceCollection`.

  • ConcurrencyMiddlewareExtensions.UseConcurrencyConflictHandling

    Adds the `ConcurrencyConflictMiddleware` to the application pipeline to automatically convert `ConcurrencyException` into RFC 7807 HTTP 409 Conflict responses.

  • DapperConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyDapper

    Registers Dapper optimistic concurrency adapter services.

  • ConcurrencyServiceCollectionExtensions.AddConflictResolver<TEntity, TResolver>

    Registers a custom domain-specific conflict resolver for the specified entity type.

  • ConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrency

    Registers core concurrency services including the default concurrency checker, controller, and rejection resolver.

  • MariaDbConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyMariaDb

    Registers MariaDB concurrency dialect services into the dependency injection container.

  • ConcurrencyMediatorServiceCollectionExtensions.AddConcurrencyMediatorBehavior

    Registers the `ConcurrencyBehavior<TRequest, TResponse>` open generic pipeline behavior in the service collection.

  • MySqlConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyMySql

    Registers MySQL concurrency dialect services into the dependency injection container.

  • OracleConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyOracle

    Registers Oracle concurrency dialect services into the dependency injection container.

  • PostgreSqlConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencyPostgreSql

    Registers PostgreSQL concurrency adapter services and diagnostic classifiers.

  • SqlServerConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencySqlServer

    Registers Microsoft SQL Server concurrency dialect services and classifiers into the dependency injection container.

  • SqliteConcurrencyServiceCollectionExtensions.AddEricksonLopezConcurrencySqlite

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

Total rows: 54 · Measured: 18 · NA / Error: 36 · Suites: 4

Observed runtimes: .NET 10.0.12 X64 RyuJIT x86-64-v3 · .NET 8.0 (JIT) · .NET 9.0 (JIT)

Observed CPUs: AMD EPYC 7763 3.15GHz, 1 CPU, 4 logical and 2 physical cores

SuiteMethodRuntimeMean (ns)Allocated (B)Status
TokenAllocationBenchmarksCreateStructVersion.NET 10.0.12 X64 RyuJIT x86-64-v300measured
TokenAllocationBenchmarksCreateExpectedVersionSpecific.NET 10.0.12 X64 RyuJIT x86-64-v30.0010measured
ConcurrencyBenchmarksDirectVersionComparison.NET 10.0.12 X64 RyuJIT x86-64-v30.1350measured
TokenAllocationBenchmarksCheckExpectedMatchesActual.NET 10.0.12 X64 RyuJIT x86-64-v30.3750measured
ConcurrencyBenchmarksCheckerCheckVersion.NET 10.0.12 X64 RyuJIT x86-64-v30.5340measured
TokenAllocationBenchmarksCreateStructToken.NET 10.0.12 X64 RyuJIT x86-64-v31.180measured
TokenAllocationBenchmarksCompareTokensValueEquality.NET 10.0.12 X64 RyuJIT x86-64-v31.8840measured
ConcurrencyBenchmarksResultConversion.NET 10.0.12 X64 RyuJIT x86-64-v33.4450measured
TokenAllocationBenchmarksFormatVersionToString.NET 10.0.12 X64 RyuJIT x86-64-v314.01748measured
TokenAllocationBenchmarksTryParseSpanVersion.NET 10.0.12 X64 RyuJIT x86-64-v314.1850measured
TokenAllocationBenchmarksTryParseStringVersion.NET 10.0.12 X64 RyuJIT x86-64-v316.2170measured
ConcurrencyBenchmarksCheckerCheckToken.NET 10.0.12 X64 RyuJIT x86-64-v322.86564measured
ConflictResolutionBenchmarksRejectFatalConflictImmediately.NET 10.0.12 X64 RyuJIT x86-64-v3106.5216measured
ConflictResolutionBenchmarksResolveTransientConflictWithMerge.NET 10.0.12 X64 RyuJIT x86-64-v3115.2224measured
ConcurrencyBenchmarksControllerExecuteCasAsync.NET 10.0.12 X64 RyuJIT x86-64-v3182.1840measured
OptimisticContentionBenchmarksSingleWorkerUncontendedCas.NET 10.0.12 X64 RyuJIT x86-64-v3201.648measured
OptimisticContentionBenchmarksVersionPreconditionMismatchEvaluation.NET 10.0.12 X64 RyuJIT x86-64-v3238.9568measured
OptimisticContentionBenchmarksParallelContentionFourWorkers.NET 10.0.12 X64 RyuJIT x86-64-v32,629.2976measured

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.

VersionSourcePublished DateSummary
v2.0.0 ↗nuget2026-09-24Published EricksonLopez.Concurrency 2.0.0 to NuGet.org.
v2.0.0 ↗github2026-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 ↗github2026-08-29Ecosystem 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 ↗nuget2026-08-29Published EricksonLopez.Concurrency 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#

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

Search EricksonLopez.* Ecosystem

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