Skip to main content
Version: Next

Class: TransactionContext

core.TransactionContext

Constructors#

constructor#

new TransactionContext(em)

Parameters#

NameType
emEntityManager<IDatabaseDriver<Connection>>

Defined in#

packages/core/src/utils/TransactionContext.ts:7

Properties#

em#

Readonly em: EntityManager<IDatabaseDriver<Connection>>


id#

Readonly id: number

Defined in#

packages/core/src/utils/TransactionContext.ts:7

Methods#

createAsync#

Static createAsync<T>(em, next): Promise<T>

Creates new TransactionContext instance and runs the code inside its domain.

Type parameters#

Name
T

Parameters#

NameType
emEntityManager<IDatabaseDriver<Connection>>
next(...args: any[]) => Promise<T>

Returns#

Promise<T>

Defined in#

packages/core/src/utils/TransactionContext.ts:14


currentTransactionContext#

Static currentTransactionContext(): undefined | TransactionContext

Returns current TransactionContext (if available).

Returns#

undefined | TransactionContext

Defined in#

packages/core/src/utils/TransactionContext.ts:27


getEntityManager#

Static getEntityManager(): undefined | EntityManager<IDatabaseDriver<Connection>>

Returns current EntityManager (if available).

Returns#

undefined | EntityManager<IDatabaseDriver<Connection>>

Defined in#

packages/core/src/utils/TransactionContext.ts:34