Class Db
Abstract base class that implements the IDb interface for managing a database connection.
public abstract class Db : IDb, IAsyncDisposable, IDisposable
- Inheritance
-
Db
- Implements
- Derived
- Inherited Members
Remarks
Ensures the database connection is in a ready state before providing access to it.
Constructors
Db(IDbConnection)
Initializes a new instance of the Db class with a provided IDbConnection.
protected Db(IDbConnection connection)
Parameters
connectionIDbConnectionThe database connection to manage.
Properties
Connection
Gets the underlying database connection.
public IDbConnection Connection { get; }
Property Value
- IDbConnection
The underlying database connection.
Methods
Close()
Closes the database connection.
public void Close()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the Db and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
Parameters
disposingbooltrue to release both managed and unmanaged resources; false to release only unmanaged resources.
DisposeAsync()
Asynchronously releases all resources used by the Db. If the underlying connection is a DbConnection, it is disposed asynchronously; otherwise, the synchronous Dispose() path is used.
public ValueTask DisposeAsync()
Returns
Open()
Opens the database connection.
public void Open()