You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Inversify with possible multi-injection case, our framework have some requirements to control bound dependencies:
container.bind('Id').to(ClassA);container.bind('Id').to(ClassB);container.bind('Id').to(ClassC).inSingletonScope();// In some cases like dynamic replacement or HMR clear, we need to unbind/rebind one dependency// For example, to unbind `ClassB` only:// cuz `container.get` can only return the instance, so we need to do use more complex way to maintain the constructor map in a wrapped methodconstallBound=container.getAll('Id__ctor');constindex=allBound.indexOf(ClassB);if(index>-1)allBound.splice(index,1);container.unbind('Id');allBound.forEach(item=>container.bind('Id').to(item));
Even we can self maintain the constructor map, it's not enough. We still need other metadata like scope, it will be a complex work.
Proposal
We are requesting a series methods to unbind/rebind a specified dependency like this:
Background
When using Inversify with possible multi-injection case, our framework have some requirements to control bound dependencies:
Even we can self maintain the constructor map, it's not enough. We still need other metadata like scope, it will be a complex work.
Proposal
We are requesting a series methods to unbind/rebind a specified dependency like this:
The text was updated successfully, but these errors were encountered: