Skip to main content
Table of Contents

Interface IStoreConflictDetector

Namespace
Stratara.Abstractions.EventSourcing
Assembly
Stratara.Abstractions.dll

Recognises a database provider's refusal of a duplicate stream version, so that the event source can surface it as a ConcurrencyException on that provider.

public interface IStoreConflictDetector
Extension Methods

Remarks

A version collision is an insert the store's unique index refuses, and every provider reports that refusal with an exception of its own. The framework registers a detector for each provider it ships a store registration for — PostgreSQL through AddNpgsqlWriteDbContextFactory, SQLite through the test-support store — and consults every registered detector when a save fails. A host that brings another provider registers its own detector alongside; the framework's keep working beside it.

A detector receives the exception the persistence layer threw and is expected to walk its inner exceptions itself, because which layer wraps the provider's exception is a provider detail.

Methods

IsUniqueViolation(Exception)

Returns whether exception, or any exception it wraps, is the provider's refusal of a row that violates a unique constraint.

bool IsUniqueViolation(Exception exception)

Parameters

exception Exception

The exception a save threw.

Returns

bool

true when the failure is a unique-constraint violation of this detector's provider; otherwise false.