Inversifyjs: Async factory

Created on 31 May 2018  路  5Comments  路  Source: inversify/InversifyJS

Hi

Are there any plans to support async factories?

Thanks

Most helpful comment

thanks @TheAifam5 .
I've tried that and i found out that with providers, the consumer is injected with a function that returns a promise to an entity (()=>Promise<T>), instead of simply an entity (T).

What I mean by async factory is to register something like (context)=>Promise<T> and have the consumer be injected with T.

All 5 comments

thanks @TheAifam5 .
I've tried that and i found out that with providers, the consumer is injected with a function that returns a promise to an entity (()=>Promise<T>), instead of simply an entity (T).

What I mean by async factory is to register something like (context)=>Promise<T> and have the consumer be injected with T.

Actually I'm looking for the same functionality.
To be able to have provided instance automatically and delegate execution async factory to inversify, instead call it manually

+1, looking for the same thing for transparent Unit of Work implementation

@amir-arad @ifree92 @episage check out #1074

Was this page helpful?
0 / 5 - 0 ratings