Skip to content

Commit 345961b

Browse files
committed
feat: add InjectMikroORMs inject decorator for easy access to multiple databases
1 parent dd3f9e3 commit 345961b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/mikro-orm.common.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export const getMikroORMToken = (name: string) => `${name}_MikroORM`;
2020
*/
2121
export const InjectMikroORM = (name: string) => Inject(getMikroORMToken(name));
2222

23+
/**
24+
* Gets the injection token for the relevant MikroORMs provider.
25+
* @returns The MikroORMs provider injection token for the supplied context name.
26+
*/
27+
export const InjectMikroORMs = () => Inject('MikroORMs');
28+
2329
/**
2430
* Gets the injection token based on context name for the relevant EntityManager provider.
2531
* @param name The context name of the database connection.

0 commit comments

Comments
 (0)