From 345961bb6f15175ce0d95e154152945b2fe6998b Mon Sep 17 00:00:00 2001 From: Steven Tsang Date: Sat, 9 Nov 2024 20:27:19 +0000 Subject: [PATCH] feat: add `InjectMikroORMs` inject decorator for easy access to multiple databases --- src/mikro-orm.common.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mikro-orm.common.ts b/src/mikro-orm.common.ts index 3aae756..afceaa3 100644 --- a/src/mikro-orm.common.ts +++ b/src/mikro-orm.common.ts @@ -20,6 +20,12 @@ export const getMikroORMToken = (name: string) => `${name}_MikroORM`; */ export const InjectMikroORM = (name: string) => Inject(getMikroORMToken(name)); +/** + * Gets the injection token for the relevant MikroORMs provider. + * @returns The MikroORMs provider injection token for the supplied context name. + */ +export const InjectMikroORMs = () => Inject('MikroORMs'); + /** * Gets the injection token based on context name for the relevant EntityManager provider. * @param name The context name of the database connection.