Skip to content

Search EricksonLopez.* Ecosystem

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

Core Concepts — ExpectedVersion, ConcurrencyVersion & CAS

EricksonLopez.Concurrency separates version representation from conflict resolution and database dialect mechanics.

  • ConcurrencyVersion (readonly record struct): Exposes None, Initial, From(long), and overflow-checked Next().
  • ExpectedVersion (readonly record struct): Provides explicit factories ExpectedVersion.Any, ExpectedVersion.New, ExpectedVersion.Exists, and ExpectedVersion.Specific(long).

    Default Struct Caution: default(ExpectedVersion) evaluates to Specific(0), not ExpectedVersion.Any. Always pass an explicit factory property or method.

  • Implement IVersionedEntity (long Version { get; }) on immutable records (returning a new copy with Version = state.Version + 1), or IMutableVersionedEntity (new long Version { get; set; }) when mutating entities in place (v2.0.0 requires the mutation delegate to advance the version or implement IMutableVersionedEntity).
  • CasResult<TEntity> exposes IsSuccess, IsConflict, IsInitialized, Entity, NewVersion, and Conflict.
  • IConcurrencyAware declares nullable ConcurrencyToken? (v2.0.0, with non-null default tokens such as string.Empty / "None").