-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Labels
Description
Is there an existing issue that is already proposing this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
I would like to provide my own DataSource, but I need to inject my ConfigService
so that I can do things in my DataSource
depending on configuration.
Describe the solution you'd like
The most straightforward solution is to provide a dataSourceFactoryInject
option.
A bigger change (which I think makes more sense) would be to remove dataSourceFactory
and add
dataSourceProviderModify: (provider) => provider
entityManagerProviderModify: (provider) => provider
which passes in the default provider, and the user can modify whatever they want, e.g.
dataSourceProviderModify: (provider) => ({
...provider,
useFactory: (typeOrmOptions, configService) => {
return new MyDataSource(typeOrmOptions, configService)
},
inject: [...provider.inject, ConfigService],
})
Teachability, documentation, adoption, migration strategy
See solution.
What is the motivation / use case for changing the behavior?
See problem.
SchroederSteffen, wadedos, ImNM, PCZeroX, anteriovieira and 15 more