If I register:
Bind<IWeapon>().To<Sword>();
Bind<IWeapon>().To<Knife>();
Bind<IWeapon>().To<ChuckNorris>();
And then retrieve via:
IEnumerable<IWeapon> weapons = ServiceLocator.Current.GetAllInstances<IWeapon>();
Am I guaranteed the bindings will always be handed back in that order?
I tried it, and it seems it does, but this could be purely incidental.
Short answer: No, you aren't!
A bit longer answer: The current implementation keeps the order. But it is not garanteed that this will still be the case in future versions of Ninject. Also you shouldn't have such business rules in the IoC container configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With