Skip to content

Data model

DBConnectionAPI has no tables, entities, mappings or stored procedures. It accesses databases only to run two constant connectivity probes through the NHibernate unit of work (IUnitOfWorkFactory, registered by AddNhibernateServices<Startup>()), and the databases it probes are chosen at run time by the caller.

Connections

Connection strings are not declared in configuration. Each connection is composed at run time from an Environment API template and a secure credential, and the API returns the composed string to the caller; see Configuration for the resolution chain and setting key names. The API itself consumes no connection of its own, and no pool code is used.

Connection Pool code Access method Purpose
Caller-named Oracle alias Not applicable NHibernate IUnitOfWorkFactory with DatabaseType.Oracle, unit name temp Connectivity probe before the string is cached and returned
Caller-named SQL Server instance Not applicable NHibernate IUnitOfWorkFactory with DatabaseType.Sql, unit name temp2 Connectivity probe before the string is cached and returned
Caller-named PostgreSQL instance Not applicable None Never probed (BR-DBC-020)

Connectivity probes

Database Statement Executed by Result handling
Oracle SELECT 1 FROM DUAL ConnectionManager.TestOracleConnection (OP-03) A non-null result means valid (BR-DBC-018)
SQL Server SELECT 1 ConnectionManager.TestSqlConnection (OP-01) A non-null result means valid (BR-DBC-018)

Both statements are constant, parameterless and read-only, so caller input never enters the SQL text. The DUAL pseudo-table is built into Oracle and is not an application table. Each probe runs on a unit of work that is disposed after use, and no transaction is begun.

Tables

No application table is read or written, so there is no table catalog, schema or CRUD matrix.

Entity mappings

None. The API defines no DbContext, ClassMap, .hbm.xml mapping or entity class.

Stored procedures

No stored procedures or PL/SQL packages are referenced by this service; its only database access is the two raw CreateSqlQuery probe statements.

Named queries

None. The API defines no NHibernate named queries.

In-memory data shapes

Shape Kind Fields or format Source
Connection cache In-memory Dictionary<string,string> held by the singleton ConnectionManager Cache key to composed string; never expires (BR-DBC-002, BR-DBC-004) DBConnectionAPI/DBConnectionAPI/Services/ConnectionManager.cs
Connection string response string Template with placeholders substituted DBConnectionAPI/DBConnectionAPI/Controllers/ConnectionsController.cs
Admin connection info Dictionary<string,string> credentials, user, pw, connectionString, optional Error (BR-DBC-023) DBConnectionAPI/DBConnectionAPI/Controllers/AdminController.cs
Secure credential setting Environment API secure string User name and password separated by a pipe DBConnectionAPI/DBConnectionAPI/Services/ConnectionManager.cs

Sources

  • DBConnectionAPI/DBConnectionAPI/Services/ConnectionManager.cs
  • DBConnectionAPI/DBConnectionAPI/Controllers/AdminController.cs
  • DBConnectionAPI/DBConnectionAPI/Controllers/ConnectionsController.cs
  • DBConnectionAPI/DBConnectionAPI/Startup.cs