4

My question is very close to How to inject an asynchronous dependency in inversify?

But, In the answer, I saw that some new feature was added in version 3. Now we have version 5. How to make this stuff with DB in version 5? Simply I need to run some async method before injecting DB. Like this:

@injectable()
export class ApplicationDbContext {

    public db!: Db;

    async build() {
        this.db = await MongoDbConnection.getConnection();
    }

}
Nazar Kalytiuk
  • 1,499
  • 1
  • 11
  • 21

0 Answers0