Open kicsiede opened 6 months ago
Hi @kicsiede, thank you for the suggestion, and sorry for the late reply! I'll look at both issues soon when I have more free time.
Hi @kicsiede, I've released v5.16.0, which allows dependency overrides to be expressed with a new Override
type.
var service = container.Resolve<IService>([ Override.Of(instance, "name") ]);
Could you please check that it works for your use case? Thanks!
It would be beneficial to have more precise control over passing dependency overrides, along with support for named bindings. Currently, our approach is as follows:
container.Resolve<Service>([ instance1, instance2... ])
In this setup, type overrides are automatically resolved based on their type and the classes/interfaces they implement, as far as I know.
I propose introducing a wrapper that the resolver could use to extract specific additional information, like this:
container.Resolve<Service>([ Arg<IExactType1>(instance1), Arg<IExactType2>("name", instance2)... ])
This approach would enable us to specify dependencies more explicitly and manage named bindings more effectively.