db property

Retrieves the active DatabaseExecutor from the Container.

If a transaction middleware is active, this returns the transaction scope. Otherwise, returns the global DatabaseAdapter.

Implementation

DatabaseExecutor get db {
  try {
    return resolve<DatabaseExecutor>();
  } catch (_) {
    return resolve<DatabaseAdapter>();
  }
}