Is it possible to register an interface in a registry, then “re-register” it to override the first registration?
I.E.:
For<ISomeInterface>().Use<SomeClass>();
For<ISomeInterface>().Use<SomeClassExtension>();
What I want here on runtime is that my object factory returns SomeClassExtension when I ask for ISomeInterface.
Thanks in advance!
Good news, I found out that yes. It all depends on the order that the registry rules are added to the object factory container. So if you are using multiple registry classes as I was doing, you need to find a way to give a priority to add them to the container.
In other words, instead of using the
.LookForRegistries()which gets all theRegistryclasses in the wrong order, try to find all theRegistryfiles, set them in the order you want and add them manually to the object factory container:That way, you have full control on what rules you want.
Hope it helps 🙂