Table of Contents

Interface IDb

Namespace
Excalibur.Data
Assembly
Excalibur.Data.Abstractions.dll

Defines a contract for database access, providing basic operations to manage a database connection.

public interface IDb

Remarks

IDb models the connection lifecycle only (open/close and access to the underlying IDbConnection); it does not itself execute commands. Command execution — and therefore the mapping of an optimistic-concurrency conflict to a typed ConcurrencyException — happens on the execute path over Connection, notably DbConnectionExtensions. That path propagates a ConcurrencyException (and any other application exception) to the caller unchanged. Resolver cancellation propagates unchanged with its token and canceled task status; other non-application infrastructure faults are wrapped as an OperationFailedException.

The lifecycle members below neither perform writes nor raise ConcurrencyException: an implementation MUST NOT repurpose them to surface conflict semantics.

Properties

Connection

Gets the underlying database connection.

IDbConnection Connection { get; }

Property Value

IDbConnection

The underlying database connection.

Methods

Close()

Closes the database connection.

void Close()

CloseAsync()

Closes the database connection asynchronously. Default implementation delegates to the synchronous Close() method. Implementations backed by DbConnection should override to call CloseAsync().

Task CloseAsync()

Returns

Task

A task representing the asynchronous close operation.

Open()

Opens the database connection.

void Open()

OpenAsync(CancellationToken)

Opens the database connection asynchronously. Default implementation delegates to the synchronous Open() method. Implementations backed by DbConnection should override to call OpenAsync(CancellationToken).

Task OpenAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

A token to monitor for cancellation requests.

Returns

Task

A task representing the asynchronous open operation.