Table of Contents

Interface IOrpheusConnectionFactory

Namespace
OrpheusInterfaces.Core
Assembly
OrpheusInterfaces.dll

Factory that creates database connections from the ADO.NET connection pool. Implementations are specific to each database engine (SQL Server, MySQL, PostgreSQL).

public interface IOrpheusConnectionFactory

Properties

ConnectionConfiguration

The database connection configuration used to build connection strings. Must be set before calling CreateConnection()/CreateConnectionAsync().

IDatabaseConnectionConfiguration ConnectionConfiguration { get; set; }

Property Value

IDatabaseConnectionConfiguration

Methods

CreateAdministrativeConnection()

Creates (but does not open) a new pooled connection to the engine's administrative/system database (SQL Server: master, MySQL: sys, PostgreSQL: postgres), using ServiceUserName/ ServicePassword/UseIntegratedSecurityForServiceConnection when configured, falling back to the main credentials otherwise. Used for database-level operations — existence checks, CREATE DATABASE — that can't run against the target database itself. Unlike CreateConnection(), the connection is left closed: callers that hold onto this connection across multiple operations manage its open/close state themselves. Callers must dispose the returned connection when done.

IDbConnection CreateAdministrativeConnection()

Returns

IDbConnection

CreateConnection()

Creates and opens a new IDbConnection from the connection pool. Callers must dispose the returned connection when done.

IDbConnection CreateConnection()

Returns

IDbConnection

CreateConnectionAsync(CancellationToken)

Asynchronously creates and opens a new IDbConnection from the connection pool. Callers must dispose the returned connection when done.

Task<IDbConnection> CreateConnectionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IDbConnection>

CreateSecondaryConnection()

Creates (but does not open) a new pooled connection to the same target database as CreateConnection(), independent of the main database's connection/transaction state — e.g. for schema introspection while the main connection may be mid-transaction. Unlike CreateConnection(), the connection is left closed: callers that hold onto this connection across multiple operations manage its open/close state themselves. Callers must dispose the returned connection when done.

IDbConnection CreateSecondaryConnection()

Returns

IDbConnection