Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): create context from async orm instance (#4812)
Added support to orm instance which wraps inside of Promise to `@CreateRequestContext()` decorator. It now additionally supports `async` callback like the below ```ts async getOrm(): Promise<MikroORM>{ // } const ORM = getOrm(); @CreateRequestContext(async () => ORM) ``` Or Promise instance ```ts @CreateRequestContext(ORM) ``` Or async `orm` property ```ts class H { constructor(protected orm: Promise<MikroORM>) {} @CreateRequestContext() async handle() { } } ``` Closes #4805
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters