ditox icon indicating copy to clipboard operation
ditox copied to clipboard

Multi factories support

Open BANOnotIT opened this issue 2 years ago • 6 comments

You have bindMultivalue utill implemented and it's cool. But is there any way to implement multi factories that can traverse parent container also?

Use case is the following: A system with plugin architecture requires plugins to be initialized and returned to plugin consumer as array. This can be partially done using following:

  • create a token to hold plugin factories
  • create a plugin multivalue token and bind resolving factory to it

Problems with this approach are following:

  • multivalue token will resolve in child containers and will not use parent container values
  • we have to implement resolution scopes by hand inside resolving factory which might lead to bugs and inconsistency

Is there some less fragile approach which doesn't involve the library API change or this feature can only be solved by adding things inside?

BANOnotIT avatar Apr 24 '23 11:04 BANOnotIT

Thanks for the idea, I'll need some time to think about it.

mnasyrov avatar Apr 27 '23 22:04 mnasyrov